<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.18">
<title>Dear ImGui Bundle</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<style>
/*! Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
/* Uncomment the following line when using as a custom stylesheet */
/* @import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"; */
html{font-family:sans-serif;-webkit-text-size-adjust:100%}
a{background:none}
a:focus{outline:thin dotted}
a:active,a:hover{outline:0}
h1{font-size:2em;margin:.67em 0}
b,strong{font-weight:bold}
abbr{font-size:.9em}
abbr[title]{cursor:help;border-bottom:1px dotted #dddddf;text-decoration:none}
dfn{font-style:italic}
hr{height:0}
mark{background:#ff0;color:#000}
code,kbd,pre,samp{font-family:monospace;font-size:1em}
pre{white-space:pre-wrap}
q{quotes:"\201C" "\201D" "\2018" "\2019"}
small{font-size:80%}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sup{top:-.5em}
sub{bottom:-.25em}
img{border:0}
svg:not(:root){overflow:hidden}
figure{margin:0}
audio,video{display:inline-block}
audio:not([controls]){display:none;height:0}
fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
legend{border:0;padding:0}
button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
button,input{line-height:normal}
button,select{text-transform:none}
button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}
button[disabled],html input[disabled]{cursor:default}
input[type=checkbox],input[type=radio]{padding:0}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
textarea{overflow:auto;vertical-align:top}
table{border-collapse:collapse;border-spacing:0}
*,::before,::after{box-sizing:border-box}
html,body{font-size:100%}
body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;line-height:1;position:relative;cursor:auto;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-wrap:anywhere;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}
a:hover{cursor:pointer}
img,object,embed{max-width:100%;height:auto}
object,embed{height:100%}
img{-ms-interpolation-mode:bicubic}
.left{float:left!important}
.right{float:right!important}
.text-left{text-align:left!important}
.text-right{text-align:right!important}
.text-center{text-align:center!important}
.text-justify{text-align:justify!important}
.hide{display:none}
img,object,svg{display:inline-block;vertical-align:middle}
textarea{height:auto;min-height:50px}
select{width:100%}
.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0}
a{color:#2156a5;text-decoration:underline;line-height:inherit}
a:hover,a:focus{color:#1d4b8f}
a img{border:0}
p{line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
p aside{font-size:.875em;line-height:1.35;font-style:italic}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
h1{font-size:2.125em}
h2{font-size:1.6875em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
h4,h5{font-size:1.125em}
h6{font-size:1em}
hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em}
em,i{font-style:italic;line-height:inherit}
strong,b{font-weight:bold;line-height:inherit}
small{font-size:60%;line-height:inherit}
code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
ul,ol,dl{line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
ul,ol{margin-left:1.5em}
ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0}
ul.circle{list-style-type:circle}
ul.disc{list-style-type:disc}
ul.square{list-style-type:square}
ul.circle ul:not([class]),ul.disc ul:not([class]),ul.square ul:not([class]){list-style:inherit}
ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
dl dt{margin-bottom:.3125em;font-weight:bold}
dl dd{margin-bottom:1.25em}
blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
h1{font-size:2.75em}
h2{font-size:2.3125em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
h4{font-size:1.4375em}}
table{background:#fff;margin-bottom:1.25em;border:1px solid #dedede;word-wrap:normal}
table thead,table tfoot{background:#f7f8f7}
table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
table tr.even,table tr.alt{background:#f8f8f7}
table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:1.6}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
.center{margin-left:auto;margin-right:auto}
.stretch{width:100%}
.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table}
.clearfix::after,.float-group::after{clear:both}
:not(pre).nobreak{word-wrap:normal}
:not(pre).nowrap{white-space:nowrap}
:not(pre).pre-wrap{white-space:pre-wrap}
:not(pre):not([class^=L])>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background:#f7f7f8;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
pre{color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;line-height:1.45;text-rendering:optimizeSpeed}
pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
pre>code{display:block}
pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
em em{font-style:normal}
strong strong{font-weight:400}
.keyseq{color:rgba(51,51,51,.8)}
kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background:#f7f7f7;border:1px solid #ccc;border-radius:3px;box-shadow:0 1px 0 rgba(0,0,0,.2),inset 0 0 0 .1em #fff;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
.keyseq kbd:first-child{margin-left:0}
.keyseq kbd:last-child{margin-right:0}
.menuseq,.menuref{color:#000}
.menuseq b:not(.caret),.menuref{font-weight:inherit}
.menuseq{word-spacing:-.02em}
.menuseq b.caret{font-size:1.25em;line-height:.8}
.menuseq i.caret{font-weight:bold;text-align:center;width:.45em}
b.button::before,b.button::after{position:relative;top:-1px;font-weight:400}
b.button::before{content:"[";padding:0 3px 0 2px}
b.button::after{content:"]";padding:0 2px 0 3px}
p a>code:hover{color:rgba(0,0,0,.9)}
#header,#content,#footnotes,#footer{width:100%;margin:0 auto;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table}
#header::after,#content::after,#footnotes::after,#footer::after{clear:both}
#content{margin-top:1.25em}
#content::before{content:none}
#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf}
#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}
#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:flex;flex-flow:row wrap}
#header .details span:first-child{margin-left:-.125em}
#header .details span.email a{color:rgba(0,0,0,.85)}
#header .details br{display:none}
#header .details br+span::before{content:"\00a0\2013\00a0"}
#header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
#header .details br+span#revremark::before{content:"\00a0|\00a0"}
#header #revnumber{text-transform:capitalize}
#header #revnumber::after{content:"\00a0"}
#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
#toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em}
#toc>ul{margin-left:.125em}
#toc ul.sectlevel0>li>a{font-style:italic}
#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
#toc li{line-height:1.3334;margin-top:.3334em}
#toc a{text-decoration:none}
#toc a:active{text-decoration:underline}
#toctitle{color:#7a2518;font-size:1.2em}
@media screen and (min-width:768px){#toctitle{font-size:1.375em}
body.toc2{padding-left:15em;padding-right:0}
#toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
#toc.toc2>ul{font-size:.9em;margin-bottom:0}
#toc.toc2 ul ul{margin-left:0;padding-left:1em}
#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
body.toc2.toc-right{padding-left:0;padding-right:15em}
body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}}
@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
#toc.toc2{width:20em}
#toc.toc2 #toctitle{font-size:1.375em}
#toc.toc2>ul{font-size:.95em}
#toc.toc2 ul ul{padding-left:1.25em}
body.toc2.toc-right{padding-left:0;padding-right:20em}}
#content #toc{border:1px solid #e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;border-radius:4px}
#content #toc>:first-child{margin-top:0}
#content #toc>:last-child{margin-bottom:0}
#footer{max-width:none;background:rgba(0,0,0,.8);padding:1.25em}
#footer-text{color:hsla(0,0%,100%,.8);line-height:1.44}
#content{margin-bottom:.625em}
.sect1{padding-bottom:.625em}
@media screen and (min-width:768px){#content{margin-bottom:1.25em}
.sect1{padding-bottom:1.25em}}
.sect1:last-child{padding-bottom:0}
.sect1+.sect1{border-top:1px solid #e7e7e9}
#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
details{margin-left:1.25rem}
details>summary{cursor:pointer;display:block;position:relative;line-height:1.6;margin-bottom:.625rem;outline:none;-webkit-tap-highlight-color:transparent}
details>summary::-webkit-details-marker{display:none}
details>summary::before{content:"";border:solid transparent;border-left:solid;border-width:.3em 0 .3em .5em;position:absolute;top:.5em;left:-1.25rem;transform:translateX(15%)}
details[open]>summary::before{border:solid transparent;border-top:solid;border-width:.5em .3em 0;transform:translateY(15%)}
details>summary::after{content:"";width:1.25rem;height:1em;position:absolute;top:.3em;left:-1.25rem}
.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
table.tableblock.fit-content>caption.title{white-space:nowrap;width:0}
.paragraph.lead>p,#preamble>.sectionbody>[class=paragraph]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)}
.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
.admonitionblock>table td.icon{text-align:center;width:80px}
.admonitionblock>table td.icon img{max-width:none}
.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6);word-wrap:anywhere}
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
.exampleblock>.content{border:1px solid #e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;border-radius:4px}
.exampleblock>.content>:first-child{margin-top:0}
.exampleblock>.content>:last-child{margin-bottom:0}
.sidebarblock{border:1px solid #dbdbd6;margin-bottom:1.25em;padding:1.25em;background:#f3f3f2;border-radius:4px}
.sidebarblock>:first-child{margin-top:0}
.sidebarblock>:last-child{margin-bottom:0}
.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
.literalblock pre,.listingblock>.content>pre{border-radius:4px;overflow-x:auto;padding:1em;font-size:.8125em}
@media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}
@media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}
.literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class=highlight],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
.literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}
.listingblock>.content{position:relative}
.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}
.listingblock:hover code[data-lang]::before{display:block}
.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:inherit;opacity:.5}
.listingblock.terminal pre .command:not([data-prompt])::before{content:"$"}
.listingblock pre.highlightjs{padding:0}
.listingblock pre.highlightjs>code{padding:1em;border-radius:4px}
.listingblock pre.prettyprint{border-width:0}
.prettyprint{background:#f7f7f8}
pre.prettyprint .linenums{line-height:1.45;margin-left:2em}
pre.prettyprint li{background:none;list-style-type:inherit;padding-left:0}
pre.prettyprint li code[data-lang]::before{opacity:1}
pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}
table.linenotable{border-collapse:separate;border:0;margin-bottom:0;background:none}
table.linenotable td[class]{color:inherit;vertical-align:top;padding:0;line-height:inherit;white-space:normal}
table.linenotable td.code{padding-left:.75em}
table.linenotable td.linenos,pre.pygments .linenos{border-right:1px solid;opacity:.35;padding-right:.5em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
pre.pygments span.linenos{display:inline-block;margin-right:.75em}
.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
.quoteblock:not(.excerpt)>.title{margin-left:-1.5em;margin-bottom:.75em}
.quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
.quoteblock blockquote{margin:0;padding:0;border:0}
.quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
.quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right}
.verseblock{margin:0 1em 1.25em}
.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans-serif;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
.verseblock pre strong{font-weight:400}
.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
.quoteblock .attribution br,.verseblock .attribution br{display:none}
.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}
.quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}
.quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0}
.quoteblock.abstract{margin:0 1em 1.25em;display:block}
.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center}
.quoteblock.excerpt>blockquote,.quoteblock .quoteblock{padding:0 0 .25em 1em;border-left:.25em solid #dddddf}
.quoteblock.excerpt,.quoteblock .quoteblock{margin-left:0}
.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem}
.quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;font-size:.85rem;text-align:left;margin-right:0}
p.tableblock:last-child{margin-bottom:0}
td.tableblock>.content{margin-bottom:1.25em;word-wrap:anywhere}
td.tableblock>.content>:last-child{margin-bottom:-1.25em}
table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
table.grid-all>*>tr>*{border-width:1px}
table.grid-cols>*>tr>*{border-width:0 1px}
table.grid-rows>*>tr>*{border-width:1px 0}
table.frame-all{border-width:1px}
table.frame-ends{border-width:1px 0}
table.frame-sides{border-width:0 1px}
table.frame-none>colgroup+*>:first-child>*,table.frame-sides>colgroup+*>:first-child>*{border-top-width:0}
table.frame-none>:last-child>:last-child>*,table.frame-sides>:last-child>:last-child>*{border-bottom-width:0}
table.frame-none>*>tr>:first-child,table.frame-ends>*>tr>:first-child{border-left-width:0}
table.frame-none>*>tr>:last-child,table.frame-ends>*>tr>:last-child{border-right-width:0}
table.stripes-all>*>tr,table.stripes-odd>*>tr:nth-of-type(odd),table.stripes-even>*>tr:nth-of-type(even),table.stripes-hover>*>tr:hover{background:#f8f8f7}
th.halign-left,td.halign-left{text-align:left}
th.halign-right,td.halign-right{text-align:right}
th.halign-center,td.halign-center{text-align:center}
th.valign-top,td.valign-top{vertical-align:top}
th.valign-bottom,td.valign-bottom{vertical-align:bottom}
th.valign-middle,td.valign-middle{vertical-align:middle}
table thead th,table tfoot th{font-weight:bold}
tbody tr th{background:#f7f8f7}
tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
p.tableblock>code:only-child{background:none;padding:0}
p.tableblock{font-size:1em}
ol{margin-left:1.75em}
ul li ol{margin-left:1.5em}
dl dd{margin-left:1.125em}
dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}
ul.unstyled,ol.unstyled{margin-left:0}
li>p:empty:only-child::before{content:"";display:inline-block}
ul.checklist>li>p:first-child{margin-left:-1em}
ul.checklist>li>p:first-child>.fa-square-o:first-child,ul.checklist>li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}
ul.checklist>li>p:first-child>input[type=checkbox]:first-child{margin-right:.25em}
ul.inline{display:flex;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em}
ul.inline>li{margin-left:1.25em}
.unstyled dl dt{font-weight:400;font-style:normal}
ol.arabic{list-style-type:decimal}
ol.decimal{list-style-type:decimal-leading-zero}
ol.loweralpha{list-style-type:lower-alpha}
ol.upperalpha{list-style-type:upper-alpha}
ol.lowerroman{list-style-type:lower-roman}
ol.upperroman{list-style-type:upper-roman}
ol.lowergreek{list-style-type:lower-greek}
.hdlist>table,.colist>table{border:0;background:none}
.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
td.hdlist1{font-weight:bold;padding-bottom:1.25em}
td.hdlist2{word-wrap:anywhere}
.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top}
.colist td:not([class]):first-child img{max-width:none}
.colist td:not([class]):last-child{padding:.25em 0}
.thumb,.th{line-height:0;display:inline-block;border:4px solid #fff;box-shadow:0 0 0 1px #ddd}
.imageblock.left{margin:.25em .625em 1.25em 0}
.imageblock.right{margin:.25em 0 1.25em .625em}
.imageblock>.title{margin-bottom:0}
.imageblock.thumb,.imageblock.th{border-width:6px}
.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
.image.left{margin-right:.625em}
.image.right{margin-left:.625em}
a.image{text-decoration:none;display:inline-block}
a.image object{pointer-events:none}
sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
sup.footnote a,sup.footnoteref a{text-decoration:none}
sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}
#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0}
#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em}
#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em}
#footnotes .footnote:last-of-type{margin-bottom:0}
#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
div.unbreakable{page-break-inside:avoid}
.big{font-size:larger}
.small{font-size:smaller}
.underline{text-decoration:underline}
.overline{text-decoration:overline}
.line-through{text-decoration:line-through}
.aqua{color:#00bfbf}
.aqua-background{background:#00fafa}
.black{color:#000}
.black-background{background:#000}
.blue{color:#0000bf}
.blue-background{background:#0000fa}
.fuchsia{color:#bf00bf}
.fuchsia-background{background:#fa00fa}
.gray{color:#606060}
.gray-background{background:#7d7d7d}
.green{color:#006000}
.green-background{background:#007d00}
.lime{color:#00bf00}
.lime-background{background:#00fa00}
.maroon{color:#600000}
.maroon-background{background:#7d0000}
.navy{color:#000060}
.navy-background{background:#00007d}
.olive{color:#606000}
.olive-background{background:#7d7d00}
.purple{color:#600060}
.purple-background{background:#7d007d}
.red{color:#bf0000}
.red-background{background:#fa0000}
.silver{color:#909090}
.silver-background{background:#bcbcbc}
.teal{color:#006060}
.teal-background{background:#007d7d}
.white{color:#bfbfbf}
.white-background{background:#fafafa}
.yellow{color:#bfbf00}
.yellow-background{background:#fafa00}
span.icon>.fa{cursor:default}
a span.icon>.fa{cursor:inherit}
.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
.admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c}
.admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
.admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900}
.admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400}
.admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000}
.conum[data-value]{display:inline-block;color:#fff!important;background:rgba(0,0,0,.8);border-radius:50%;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
.conum[data-value] *{color:#fff!important}
.conum[data-value]+b{display:none}
.conum[data-value]::after{content:attr(data-value)}
pre .conum[data-value]{position:relative;top:-.125em}
b.conum *{color:inherit!important}
.conum:not([data-value]):empty{display:none}
dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
h1,h2,p,td.content,span.alt,summary{letter-spacing:-.01em}
p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
p,blockquote,dt,td.content,span.alt,summary{font-size:1.0625rem}
p{margin-bottom:1.25rem}
.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
.exampleblock>.content{background:#fffef7;border-color:#e0e0dc;box-shadow:0 1px 4px #e0e0dc}
.print-only{display:none!important}
@page{margin:1.25cm .75cm}
@media print{*{box-shadow:none!important;text-shadow:none!important}
html{font-size:80%}
a{color:inherit!important;text-decoration:underline!important}
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
abbr[title]{border-bottom:1px dotted}
abbr[title]::after{content:" (" attr(title) ")"}
pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
thead{display:table-header-group}
svg{max-width:100%}
p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
#header,#content,#footnotes,#footer{max-width:none}
#toc,.sidebarblock,.exampleblock>.content{background:none!important}
#toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important}
body.book #header{text-align:center}
body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em}
body.book #header .details{border:0!important;display:block;padding:0!important}
body.book #header .details span:first-child{margin-left:0!important}
body.book #header .details br{display:block}
body.book #header .details br+span::before{content:none!important}
body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
.listingblock code[data-lang]::before{display:block}
#footer{padding:0 .9375em}
.hide-on-print{display:none!important}
.print-only{display:block!important}
.hide-for-print{display:none!important}
.show-for-print{display:inherit!important}}
@media amzn-kf8,print{#header>h1:first-child{margin-top:1.25rem}
.sect1{padding:0!important}
.sect1+.sect1{border:0}
#footer{background:none}
#footer-text{color:rgba(0,0,0,.6);font-size:.9em}}
@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}}
</style>
<style>
pre.pygments .hll { background-color: #ffffcc }
pre.pygments { background: #f8f8f8; }
pre.pygments .tok-c { color: #3D7B7B; font-style: italic } /* Comment */
pre.pygments .tok-err { border: 1px solid #FF0000 } /* Error */
pre.pygments .tok-k { color: #008000; font-weight: bold } /* Keyword */
pre.pygments .tok-o { color: #666666 } /* Operator */
pre.pygments .tok-ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
pre.pygments .tok-cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
pre.pygments .tok-cp { color: #9C6500 } /* Comment.Preproc */
pre.pygments .tok-cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
pre.pygments .tok-c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
pre.pygments .tok-cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
pre.pygments .tok-gd { color: #A00000 } /* Generic.Deleted */
pre.pygments .tok-ge { font-style: italic } /* Generic.Emph */
pre.pygments .tok-gr { color: #E40000 } /* Generic.Error */
pre.pygments .tok-gh { color: #000080; font-weight: bold } /* Generic.Heading */
pre.pygments .tok-gi { color: #008400 } /* Generic.Inserted */
pre.pygments .tok-go { color: #717171 } /* Generic.Output */
pre.pygments .tok-gp { color: #000080; font-weight: bold } /* Generic.Prompt */
pre.pygments .tok-gs { font-weight: bold } /* Generic.Strong */
pre.pygments .tok-gu { color: #800080; font-weight: bold } /* Generic.Subheading */
pre.pygments .tok-gt { color: #0044DD } /* Generic.Traceback */
pre.pygments .tok-kc { color: #008000; font-weight: bold } /* Keyword.Constant */
pre.pygments .tok-kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
pre.pygments .tok-kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
pre.pygments .tok-kp { color: #008000 } /* Keyword.Pseudo */
pre.pygments .tok-kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
pre.pygments .tok-kt { color: #B00040 } /* Keyword.Type */
pre.pygments .tok-m { color: #666666 } /* Literal.Number */
pre.pygments .tok-s { color: #BA2121 } /* Literal.String */
pre.pygments .tok-na { color: #687822 } /* Name.Attribute */
pre.pygments .tok-nb { color: #008000 } /* Name.Builtin */
pre.pygments .tok-nc { color: #0000FF; font-weight: bold } /* Name.Class */
pre.pygments .tok-no { color: #880000 } /* Name.Constant */
pre.pygments .tok-nd { color: #AA22FF } /* Name.Decorator */
pre.pygments .tok-ni { color: #717171; font-weight: bold } /* Name.Entity */
pre.pygments .tok-ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
pre.pygments .tok-nf { color: #0000FF } /* Name.Function */
pre.pygments .tok-nl { color: #767600 } /* Name.Label */
pre.pygments .tok-nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
pre.pygments .tok-nt { color: #008000; font-weight: bold } /* Name.Tag */
pre.pygments .tok-nv { color: #19177C } /* Name.Variable */
pre.pygments .tok-ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
pre.pygments .tok-w { color: #bbbbbb } /* Text.Whitespace */
pre.pygments .tok-mb { color: #666666 } /* Literal.Number.Bin */
pre.pygments .tok-mf { color: #666666 } /* Literal.Number.Float */
pre.pygments .tok-mh { color: #666666 } /* Literal.Number.Hex */
pre.pygments .tok-mi { color: #666666 } /* Literal.Number.Integer */
pre.pygments .tok-mo { color: #666666 } /* Literal.Number.Oct */
pre.pygments .tok-sa { color: #BA2121 } /* Literal.String.Affix */
pre.pygments .tok-sb { color: #BA2121 } /* Literal.String.Backtick */
pre.pygments .tok-sc { color: #BA2121 } /* Literal.String.Char */
pre.pygments .tok-dl { color: #BA2121 } /* Literal.String.Delimiter */
pre.pygments .tok-sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
pre.pygments .tok-s2 { color: #BA2121 } /* Literal.String.Double */
pre.pygments .tok-se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
pre.pygments .tok-sh { color: #BA2121 } /* Literal.String.Heredoc */
pre.pygments .tok-si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
pre.pygments .tok-sx { color: #008000 } /* Literal.String.Other */
pre.pygments .tok-sr { color: #A45A77 } /* Literal.String.Regex */
pre.pygments .tok-s1 { color: #BA2121 } /* Literal.String.Single */
pre.pygments .tok-ss { color: #19177C } /* Literal.String.Symbol */
pre.pygments .tok-bp { color: #008000 } /* Name.Builtin.Pseudo */
pre.pygments .tok-fm { color: #0000FF } /* Name.Function.Magic */
pre.pygments .tok-vc { color: #19177C } /* Name.Variable.Class */
pre.pygments .tok-vg { color: #19177C } /* Name.Variable.Global */
pre.pygments .tok-vi { color: #19177C } /* Name.Variable.Instance */
pre.pygments .tok-vm { color: #19177C } /* Name.Variable.Magic */
pre.pygments .tok-il { color: #666666 } /* Literal.Number.Integer.Long */
</style>
<script data-goatcounter="https://pthom-imgui-bundle.goatcounter.com/count"
        async src="//gc.zgo.at/count.js"></script>
<style>.toc-current{font-weight: bold;} .toc-root{font-family: "Open Sans","DejaVu Sans",sans-serif;
                       font-size: 0.9em;} #content{display: flex; flex-direction: column; flex: 1 1 auto;}
             .nav-footer{text-align: center; margin-top: auto;}
             .nav-footer > p > a {white-space: nowrap;}</style>
</head>
<body id="quickstart" class="article toc2 toc-left">
<div id="header">
<h1>Dear ImGui Bundle</h1>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<p><span class="toc-root"><a href="index.html">Dear ImGui Bundle</a></span></p><ul class="sectlevel1">
<li><a href="introduction.html">What&#8217;s in the pack?</a>
</li>
<li><a href="install_python.html">Install for Python</a>
</li>
<li><a href="install_cpp.html">Install for C&#43;&#43;</a>
</li>
<li><a href="quickstart.html"><span class="toc-current">Quick Start &amp; Examples</span></a>
<ul class="sectlevel2">
<li><a href="quickstart.html#_hello_world_in_python">Hello, World in Python</a>
</li>
<li><a href="quickstart.html#_hello_world_in_c">Hello, World in C&#43;&#43;</a>
</li>
<li><a href="quickstart.html#_complex_layouts_with_docking_windows">Complex layouts with docking windows</a>
</li>
<li><a href="quickstart.html#_custom_3d_background">Custom 3D Background</a>
</li>
<li><a href="quickstart.html#quickstart_testengine">Test &amp; Automation with ImGui Test Engine</a>
</li>
<li><a href="quickstart.html#_display_analyze_images_with_immvision">Display &amp; analyze images with ImmVision</a>
</li>
<li><a href="quickstart.html#_widgets">Widgets</a>
</li>
</ul>
</li>
<li><a href="assets_about.html">Assets</a>
</li>
<li><a href="manual.html">Usage instructions</a>
</li>
<li><a href="python_specific.html">Usage instructions: additional info for Python users</a>
</li>
<li><a href="cpp_specific.html">Usage instructions: additional info for C&#43;&#43; users</a>
</li>
<li><a href="words_author.html">Closing words</a>
</li>
<li><a href="support_project.html">Support the project</a>
</li>
<li><a href="faq.html">FAQ</a>
</li>
<li><a href="devel_docs.html">Developer docs</a>
</li>
</ul>
</div>
</div>
<div id="content">
<div class="sect1">
<h2 id="quickstart">Quick Start &amp; Examples</h2>
<div class="sectionbody">
<div class="paragraph">
<p>First, install Dear ImGui Bundle following the <a href="#install-instructions">[install-instructions]</a>.</p>
</div>
<div class="paragraph">
<p>Then study the examples below.</p>
</div>
<div class="sect2">
<h3 id="_hello_world_in_python">Hello, World in Python</h3>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_hello.jpg" alt="demo hello">
</div>
<div class="title">Figure 3. Hello World</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_hello_world.html">Run this demo in your browser</a></p>
</div>
<div class="paragraph">
<p><a href="https://github.com/pthom/imgui_bundle/tree/main/bindings/imgui_bundle/demos_python/demos_immapp/demo_hello_world.py">demo_hello_world.py</a></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="python"><span></span><span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">imgui</span><span class="tok-p">,</span> <span class="tok-n">immapp</span>


<span class="tok-k">def</span> <span class="tok-nf">gui</span><span class="tok-p">():</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Hello, world!&quot;</span><span class="tok-p">)</span>


<span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">run</span><span class="tok-p">(</span>
    <span class="tok-n">gui_function</span><span class="tok-o">=</span><span class="tok-n">gui</span><span class="tok-p">,</span>  <span class="tok-c1"># The Gui function to run</span>
    <span class="tok-n">window_title</span><span class="tok-o">=</span><span class="tok-s2">&quot;Hello!&quot;</span><span class="tok-p">,</span>  <span class="tok-c1"># the window title</span>
    <span class="tok-n">window_size_auto</span><span class="tok-o">=</span><span class="tok-kc">True</span><span class="tok-p">,</span>  <span class="tok-c1"># Auto size the application window given its widgets</span>
    <span class="tok-c1"># Uncomment the next line to restore window position and size from previous run</span>
    <span class="tok-c1"># window_restore_previous_geometry==True</span>
<span class="tok-p">)</span></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_hello_world_in_c">Hello, World in C&#43;&#43;</h3>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_hello.jpg" alt="demo hello">
</div>
<div class="title">Figure 4. Hello World</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_hello_world.html">Run this demo in your browser</a></p>
</div>
<div class="paragraph">
<p><em><a href="https://github.com/pthom/imgui_bundle/tree/main/bindings/imgui_bundle/demos_cpp/demos_immapp/demo_hello_world.cpp">demo_hello_world.cpp</a></em></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cpp"><span></span><span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;immapp/immapp.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui.h&quot;</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">Gui</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Hello, world!&quot;</span><span class="tok-p">);</span>
<span class="tok-p">}</span>

<span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-nf">main</span><span class="tok-p">(</span><span class="tok-kt">int</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-kt">char</span><span class="tok-w"> </span><span class="tok-o">**</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">ImmApp</span><span class="tok-o">::</span><span class="tok-n">Run</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-n">Gui</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;Hello!&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-nb">true</span><span class="tok-w"> </span><span class="tok-c1">// window_size_auto</span>
<span class="tok-w">        </span><span class="tok-c1">// Uncomment the next line to restore window position and size from previous run</span>
<span class="tok-w">        </span><span class="tok-c1">// , true // windowRestorePreviousGeometry</span>
<span class="tok-w">    </span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>
<span class="tok-p">}</span></code></pre>
</div>
</div>
<details>
<summary class="title">C&#43;&#43; build instructions (click to expand)</summary>
<div class="content">
<div class="paragraph">
<p><strong>Build with cmake, using <code>imgui_bundle_add_app</code></strong></p>
</div>
<div class="paragraph">
<p><code>imgui_bundle_add_app</code> is a cmake command, close to <code>add_executable</code>, which will:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>automatically link your app to the required libraries (imgui_bundle, OpenGl, glad, etc)</p>
</li>
<li>
<p>embed the assets (for desktop, mobile, and emscripten apps)</p>
</li>
<li>
<p>add an icon for your app (on desktop and mobile platforms)</p>
</li>
<li>
<p>perform additional customization (app icon and name on mobile platforms, etc)</p>
</li>
</ul>
</div>
<div class="paragraph">
<p><strong>Option 1: using imgui_bundle as a submodule</strong></p>
</div>
<div class="paragraph">
<p>First, add imgui_bundle as a submodule:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="bash"><span></span>git<span class="tok-w"> </span>submodule<span class="tok-w"> </span>add<span class="tok-w"> </span>https://github.com/pthom/imgui_bundle.git
<span class="tok-nb">cd</span><span class="tok-w"> </span>imgui_bundle
git<span class="tok-w"> </span>submodule<span class="tok-w"> </span>update<span class="tok-w"> </span>--init<span class="tok-w"> </span>--recursive</code></pre>
</div>
</div>
<div class="paragraph">
<p>Then, write a simple CMakeLists file where you add imgui_bundle, then call <code>imgui_bundle_add_app</code> to create your application.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cmake"><span></span><span class="tok-nb">cmake_minimum_required</span><span class="tok-p">(</span><span class="tok-s">VERSION</span><span class="tok-w"> </span><span class="tok-s">3.20</span><span class="tok-p">)</span>
<span class="tok-nb">project</span><span class="tok-p">(</span><span class="tok-s">imgui_bundle_hello</span><span class="tok-p">)</span>
<span class="tok-nb">set</span><span class="tok-p">(</span><span class="tok-s">CMAKE_CXX_STANDARD</span><span class="tok-w"> </span><span class="tok-s">17</span><span class="tok-p">)</span>

<span class="tok-nb">add_subdirectory</span><span class="tok-p">(</span><span class="tok-s">imgui_bundle</span><span class="tok-p">)</span>
<span class="tok-nb">imgui_bundle_add_app</span><span class="tok-p">(</span><span class="tok-s">hello_world</span><span class="tok-w"> </span><span class="tok-s">hello_world.cpp</span><span class="tok-p">)</span></code></pre>
</div>
</div>
<div class="paragraph">
<p><strong>Option 2 : Fetch imgui_bundle during compilation</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cmake"><span></span><span class="tok-nb">cmake_minimum_required</span><span class="tok-p">(</span><span class="tok-s">VERSION</span><span class="tok-w"> </span><span class="tok-s">3.12</span><span class="tok-p">)</span>
<span class="tok-nb">project</span><span class="tok-p">(</span><span class="tok-s">helloworld_with_helloimgui</span><span class="tok-p">)</span>
<span class="tok-nb">set</span><span class="tok-p">(</span><span class="tok-s">CMAKE_CXX_STANDARD</span><span class="tok-w"> </span><span class="tok-s">17</span><span class="tok-p">)</span>

<span class="tok-nb">include</span><span class="tok-p">(</span><span class="tok-s">FetchContent</span><span class="tok-p">)</span>
<span class="tok-nb">Set</span><span class="tok-p">(</span><span class="tok-s">FETCHCONTENT_QUIET</span><span class="tok-w"> </span><span class="tok-s">FALSE</span><span class="tok-p">)</span>
<span class="tok-nb">FetchContent_Declare</span><span class="tok-p">(</span><span class="tok-s">imgui_bundle</span><span class="tok-w"> </span><span class="tok-s">GIT_REPOSITORY</span><span class="tok-w"> </span><span class="tok-s">https://github.com/pthom/imgui_bundle.git</span><span class="tok-w"> </span><span class="tok-s">GIT_TAG</span><span class="tok-w"> </span><span class="tok-s">main</span><span class="tok-p">)</span>
<span class="tok-nb">FetchContent_MakeAvailable</span><span class="tok-p">(</span><span class="tok-s">imgui_bundle</span><span class="tok-p">)</span>
<span class="tok-c"># set(IMMVISION_FETCH_OPENCV ON) # optional, if you wish to build ImmVision</span>

<span class="tok-c"># Build your app</span>
<span class="tok-nb">imgui_bundle_add_app</span><span class="tok-p">(</span><span class="tok-s">hello_world</span><span class="tok-w"> </span><span class="tok-s">hello_world.cpp</span><span class="tok-p">)</span></code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
This cmake file is part of a quick start template available at <a href="https://github.com/pthom/imgui_bundle_template">https://github.com/pthom/imgui_bundle_template</a>. Refer to it if you wish to customize the application icon.
</td>
</tr>
</table>
</div>
</div>
</details>
</div>
<div class="sect2">
<h3 id="_complex_layouts_with_docking_windows">Complex layouts with docking windows</h3>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_docking.jpg" alt="demo docking" width="400">
</div>
<div class="title">Figure 5. Complex docking layout</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_docking.html">Run this demo in your browser</a></p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<div class="title">Tip</div>
</td>
<td class="content">
As shown in the screenshot, Dear ImGui Bundle provides a variety of predefined themes. In this demo, you can access them via the menu "View/Theme".
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>This demonstration showcases how to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>set up a complex docking layouts (with several possible layouts):</p>
</li>
<li>
<p>use the status bar</p>
</li>
<li>
<p>use default menus (App and view menu), and how to customize them</p>
</li>
<li>
<p>display a log window</p>
</li>
<li>
<p>load additional fonts</p>
</li>
<li>
<p>use a specific application state (instead of using static variables)</p>
</li>
<li>
<p>save some additional user settings within imgui ini file</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Its source code is heavily documented and should be self-explanatory.</p>
</div>
<details>
<summary class="title">Click to see its source code in C&#43;&#43;</summary>
<div class="content">
<div class="paragraph">
<p>C&#43;&#43;</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cpp"><span></span><span class="tok-cm">/*</span>
<span class="tok-cm">A more complex app demo</span>

<span class="tok-cm">It demonstrates how to:</span>
<span class="tok-cm">- set up a complex docking layouts (with several possible layouts):</span>
<span class="tok-cm">- use the status bar</span>
<span class="tok-cm">- use default menus (App and view menu), and how to customize them</span>
<span class="tok-cm">- display a log window</span>
<span class="tok-cm">- load additional fonts, possibly colored, and with emojis</span>
<span class="tok-cm">- use a specific application state (instead of using static variables)</span>
<span class="tok-cm">- save some additional user settings within imgui ini file</span>
<span class="tok-cm">- use borderless windows, that are movable and resizable</span>
<span class="tok-cm"> */</span>

<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;hello_imgui/hello_imgui.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;hello_imgui/icons_font_awesome_6.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;nlohmann/json.hpp&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_stdlib.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_internal.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;demo_utils/api_demos.h&quot;</span>

<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;sstream&gt;</span>

<span class="tok-c1">// Poor man&#39;s fix for C++ late arrival in the unicode party:</span>
<span class="tok-c1">//    - C++17: u8&quot;my string&quot; is of type const char*</span>
<span class="tok-c1">//    - C++20: u8&quot;my string&quot; is of type const char8_t*</span>
<span class="tok-c1">// However, ImGui text functions expect const char*.</span>
<span class="tok-cp">#ifdef __cpp_char8_t</span>
<span class="tok-cp">#define U8_TO_CHAR(x) reinterpret_cast&lt;const char*&gt;(x)</span>
<span class="tok-cp">#else</span>
<span class="tok-cp">#define U8_TO_CHAR(x) x</span>
<span class="tok-cp">#endif</span>
<span class="tok-c1">// And then, we need to tell gcc to stop validating format string (it gets confused by the u8&quot;&quot; string)</span>
<span class="tok-cp">#ifdef __GNUC__</span>
<span class="tok-cp">#pragma GCC diagnostic ignored &quot;-Wformat&quot;</span>
<span class="tok-cp">#endif</span>


<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">//    Our Application State</span>
<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-k">struct</span><span class="tok-w"> </span><span class="tok-nc">MyAppSettings</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">InputTextData</span><span class="tok-w"> </span><span class="tok-n">motto</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">InputTextData</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-s">&quot;Hello, Dear ImGui</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">        </span><span class="tok-s">&quot;Unleash your creativity!</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-nb">true</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-c1">// multiline</span>
<span class="tok-w">        </span><span class="tok-n">ImVec2</span><span class="tok-p">(</span><span class="tok-mf">14.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">3.f</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-c1">// initial size (in em)</span>
<span class="tok-w">        </span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">value</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">10</span><span class="tok-p">;</span>
<span class="tok-p">};</span>

<span class="tok-k">struct</span><span class="tok-w"> </span><span class="tok-nc">AppState</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">f</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.0f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">counter</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">rocket_launch_time</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">rocket_progress</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.0f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-k">enum</span><span class="tok-w"> </span><span class="tok-k">class</span><span class="tok-w"> </span><span class="tok-nc">RocketState</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">Init</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-n">Preparing</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-n">Launched</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-n">RocketState</span><span class="tok-w"> </span><span class="tok-n">rocket_state</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">RocketState</span><span class="tok-o">::</span><span class="tok-n">Init</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">MyAppSettings</span><span class="tok-w"> </span><span class="tok-n">myAppSettings</span><span class="tok-p">;</span><span class="tok-w"> </span><span class="tok-c1">// This values will be stored in the application settings</span>
<span class="tok-w">    </span><span class="tok-n">ImFont</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">TitleFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-k">nullptr</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImFont</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">ColorFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-k">nullptr</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImFont</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">EmojiFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-k">nullptr</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImFont</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">LargeIconFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-k">nullptr</span><span class="tok-p">;</span>
<span class="tok-p">};</span>


<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">//    Additional fonts handling</span>
<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">LoadFonts</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-c1">// This is called by runnerParams.callbacks.LoadAdditionalFonts</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// First, load the default font (the default font should be loaded first)</span>
<span class="tok-w">    </span><span class="tok-c1">// In this example, we instruct HelloImGui to use FontAwesome6 instead of FontAwesome4</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetRunnerParams</span><span class="tok-p">()</span><span class="tok-o">-&gt;</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">defaultIconFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DefaultIconFont</span><span class="tok-o">::</span><span class="tok-n">FontAwesome6</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">ImGuiDefaultSettings</span><span class="tok-o">::</span><span class="tok-n">LoadDefaultFont_WithFontAwesomeIcons</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-c1">// Load the title font. Also manually merge FontAwesome icons to it</span>
<span class="tok-w">    </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LoadFontTTF_WithFontAwesomeIcons</span><span class="tok-p">(</span><span class="tok-s">&quot;fonts/Roboto/Roboto-BoldItalic.ttf&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">18.f</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-c1">// Load an Emoji font</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">FontLoadingParams</span><span class="tok-w"> </span><span class="tok-n">fontLoadingParamsEmoji</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">EmojiFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LoadFont</span><span class="tok-p">(</span><span class="tok-s">&quot;fonts/NotoEmoji-Regular.ttf&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">24.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">fontLoadingParamsEmoji</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-c1">// Load a large icon font</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">FontLoadingParams</span><span class="tok-w"> </span><span class="tok-n">fontLoadingParamsLargeIcon</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">LargeIconFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LoadFont</span><span class="tok-p">(</span><span class="tok-s">&quot;fonts/Font_Awesome_6_Free-Solid-900.otf&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">24.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">fontLoadingParamsLargeIcon</span><span class="tok-p">);</span>

<span class="tok-cp">#ifdef IMGUI_ENABLE_FREETYPE</span>
<span class="tok-w">    </span><span class="tok-c1">// Load a colored font (requires FreeType &amp; lunasvg)</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">FontLoadingParams</span><span class="tok-w"> </span><span class="tok-n">fontLoadingParamsColor</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">fontLoadingParamsColor</span><span class="tok-p">.</span><span class="tok-n">loadColor</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">ColorFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LoadFont</span><span class="tok-p">(</span><span class="tok-s">&quot;fonts/Playbox/Playbox-FREE.otf&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">24.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">fontLoadingParamsColor</span><span class="tok-p">);</span>
<span class="tok-cp">#endif</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">ImFont</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">font</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PushFont</span><span class="tok-p">(</span><span class="tok-n">font</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">font</span><span class="tok-o">-&gt;</span><span class="tok-n">LegacySize</span><span class="tok-p">);</span>
<span class="tok-p">}</span>


<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">//    Save additional settings in the ini file</span>
<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">// This demonstrates how to store additional info in the application settings</span>
<span class="tok-c1">// Use this sparingly!</span>
<span class="tok-c1">// This is provided as a convenience only, and it is not intended to store large quantities of text data.</span>

<span class="tok-c1">// Warning, the save/load function below are quite simplistic!</span>
<span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-nf">MyAppSettingsToString</span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">MyAppSettings</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">myAppSettings</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">using</span><span class="tok-w"> </span><span class="tok-k">namespace</span><span class="tok-w"> </span><span class="tok-nn">nlohmann</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">json</span><span class="tok-w"> </span><span class="tok-n">j</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">j</span><span class="tok-p">[</span><span class="tok-s">&quot;motto&quot;</span><span class="tok-p">]</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">InputTextDataToString</span><span class="tok-p">(</span><span class="tok-n">myAppSettings</span><span class="tok-p">.</span><span class="tok-n">motto</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">j</span><span class="tok-p">[</span><span class="tok-s">&quot;value&quot;</span><span class="tok-p">]</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">myAppSettings</span><span class="tok-p">.</span><span class="tok-n">value</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">j</span><span class="tok-p">.</span><span class="tok-n">dump</span><span class="tok-p">();</span>
<span class="tok-p">}</span>
<span class="tok-n">MyAppSettings</span><span class="tok-w"> </span><span class="tok-n">StringToMyAppSettings</span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">s</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">s</span><span class="tok-p">.</span><span class="tok-n">empty</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">MyAppSettings</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">MyAppSettings</span><span class="tok-w"> </span><span class="tok-n">myAppSettings</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">using</span><span class="tok-w"> </span><span class="tok-k">namespace</span><span class="tok-w"> </span><span class="tok-nn">nlohmann</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">try</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">json</span><span class="tok-w"> </span><span class="tok-n">j</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">json</span><span class="tok-o">::</span><span class="tok-n">parse</span><span class="tok-p">(</span><span class="tok-n">s</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">myAppSettings</span><span class="tok-p">.</span><span class="tok-n">motto</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">InputTextDataFromString</span><span class="tok-p">(</span><span class="tok-n">j</span><span class="tok-p">[</span><span class="tok-s">&quot;motto&quot;</span><span class="tok-p">].</span><span class="tok-n">get</span><span class="tok-o">&lt;</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&gt;</span><span class="tok-p">());</span>
<span class="tok-w">        </span><span class="tok-n">myAppSettings</span><span class="tok-p">.</span><span class="tok-n">value</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">j</span><span class="tok-p">[</span><span class="tok-s">&quot;value&quot;</span><span class="tok-p">];</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-k">catch</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">json</span><span class="tok-o">::</span><span class="tok-n">exception</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">e</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Error</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Error while parsing user settings: %s&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">e</span><span class="tok-p">.</span><span class="tok-n">what</span><span class="tok-p">());</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">myAppSettings</span><span class="tok-p">;</span>
<span class="tok-p">}</span>

<span class="tok-c1">// Note: LoadUserSettings() and SaveUserSettings() will be called in the callbacks `PostInit` and `BeforeExit`:</span>
<span class="tok-c1">//     runnerParams.callbacks.PostInit = [&amp;appState]   { LoadMyAppSettings(appState);};</span>
<span class="tok-c1">//     runnerParams.callbacks.BeforeExit = [&amp;appState] { SaveMyAppSettings(appState);};</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">LoadMyAppSettings</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-c1">//</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">myAppSettings</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">StringToMyAppSettings</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LoadUserPref</span><span class="tok-p">(</span><span class="tok-s">&quot;MyAppSettings&quot;</span><span class="tok-p">));</span>
<span class="tok-p">}</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">SaveMyAppSettings</span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">SaveUserPref</span><span class="tok-p">(</span><span class="tok-s">&quot;MyAppSettings&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">MyAppSettingsToString</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">myAppSettings</span><span class="tok-p">));</span>
<span class="tok-p">}</span>

<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">//    Gui functions used in this demo</span>
<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>

<span class="tok-c1">// Display a button that will hide the application window</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoHideWindow</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Hide app window&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">double</span><span class="tok-w"> </span><span class="tok-n">lastHideTime</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">-1.</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Hide&quot;</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">lastHideTime</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w">  </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetTime</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetRunnerParams</span><span class="tok-p">()</span><span class="tok-o">-&gt;</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">hidden</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;By clicking this button, you can hide the window for 3 seconds.&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">lastHideTime</span><span class="tok-w"> </span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-mf">0.</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-kt">double</span><span class="tok-w"> </span><span class="tok-n">now</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetTime</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">now</span><span class="tok-w"> </span><span class="tok-o">-</span><span class="tok-w"> </span><span class="tok-n">lastHideTime</span><span class="tok-w"> </span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-mf">3.</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">lastHideTime</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">-1.</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetRunnerParams</span><span class="tok-p">()</span><span class="tok-o">-&gt;</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">hidden</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-p">}</span>

<span class="tok-c1">// Display a button that will add another dockable window during execution</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoShowAdditionalWindow</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// In order to add a dockable window during execution, you should use</span>
<span class="tok-w">    </span><span class="tok-c1">//     HelloImGui::AddDockableWindow()</span>
<span class="tok-w">    </span><span class="tok-c1">// Note: you should not modify manually the content of runnerParams.dockingParams.dockableWindows</span>
<span class="tok-w">    </span><span class="tok-c1">//       (since HelloImGui is constantly looping on it)</span>

<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Dynamically add window&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">currentWindow</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetCurrentWindow</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-kt">char</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">windowName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Additional Window&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Show additional window&quot;</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">additionalWindow</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">additionalWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">windowName</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">additionalWindow</span><span class="tok-p">.</span><span class="tok-n">includeInViewMenu</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span><span class="tok-w">       </span><span class="tok-c1">// this window is not shown in the view menu,</span>
<span class="tok-w">        </span><span class="tok-n">additionalWindow</span><span class="tok-p">.</span><span class="tok-n">rememberIsVisible</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span><span class="tok-w">       </span><span class="tok-c1">// its visibility is not saved in the settings file,</span>
<span class="tok-w">        </span><span class="tok-n">additionalWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MiscSpace&quot;</span><span class="tok-p">;</span><span class="tok-w">     </span><span class="tok-c1">// when shown, it will appear in MiscSpace.</span>
<span class="tok-w">        </span><span class="tok-n">additionalWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;This is the additional window&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">};</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">AddDockableWindow</span><span class="tok-p">(</span>
<span class="tok-w">            </span><span class="tok-n">additionalWindow</span><span class="tok-p">,</span>
<span class="tok-w">            </span><span class="tok-nb">false</span><span class="tok-w">  </span><span class="tok-c1">// forceDockspace=false: means that the window will be docked to the last space it was docked to</span>
<span class="tok-w">                   </span><span class="tok-c1">// i.e. dockSpaceName is ignored if the user previously moved the window to another space</span>
<span class="tok-w">        </span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetItemTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;By clicking this button, you can show an additional window&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Remove additional window&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">RemoveDockableWindow</span><span class="tok-p">(</span><span class="tok-n">windowName</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetItemTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;By clicking this button, you can remove the additional window&quot;</span><span class="tok-p">);</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoLogs</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Log Demo&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-c1">// Edit a float using a slider from 0.0f to 1.0f</span>
<span class="tok-w">    </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SliderFloat</span><span class="tok-p">(</span><span class="tok-s">&quot;float&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.0f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">1.0f</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">changed</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Warning</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;state.f was changed to %f&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">f</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-c1">// Buttons return true when clicked (most widgets return true when edited/activated)</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Button&quot;</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">counter</span><span class="tok-o">++</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Button was pressed&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;counter = %d&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">counter</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;These widgets will interact with the log window&quot;</span><span class="tok-p">);</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoUserSettings</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;User settings&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetNextItemWidth</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">(</span><span class="tok-mf">7.f</span><span class="tok-p">));</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SliderInt</span><span class="tok-p">(</span><span class="tok-s">&quot;Value&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">myAppSettings</span><span class="tok-p">.</span><span class="tok-n">value</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">100</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">InputTextResizable</span><span class="tok-p">(</span><span class="tok-s">&quot;Motto&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">myAppSettings</span><span class="tok-p">.</span><span class="tok-n">motto</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;(this text widget is resizable)&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;The values below are stored in the application settings ini file and restored at startup&quot;</span><span class="tok-p">);</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoRocket</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Status Bar Demo&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_state</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">AppState</span><span class="tok-o">::</span><span class="tok-n">RocketState</span><span class="tok-o">::</span><span class="tok-n">Init</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_ROCKET</span><span class="tok-s">&quot; Launch rocket&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_launch_time</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-kt">float</span><span class="tok-p">)</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetTime</span><span class="tok-p">();</span>
<span class="tok-w">            </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_state</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">AppState</span><span class="tok-o">::</span><span class="tok-n">RocketState</span><span class="tok-o">::</span><span class="tok-n">Preparing</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Warning</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Rocket is being prepared&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-k">else</span><span class="tok-w"> </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_state</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">AppState</span><span class="tok-o">::</span><span class="tok-n">RocketState</span><span class="tok-o">::</span><span class="tok-n">Preparing</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Please Wait&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_progress</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-kt">float</span><span class="tok-p">)(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetTime</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">-</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_launch_time</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-o">/</span><span class="tok-w"> </span><span class="tok-mf">3.f</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_progress</span><span class="tok-w"> </span><span class="tok-o">&gt;=</span><span class="tok-w"> </span><span class="tok-mf">1.0f</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_state</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">AppState</span><span class="tok-o">::</span><span class="tok-n">RocketState</span><span class="tok-o">::</span><span class="tok-n">Launched</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Warning</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Rocket was launched&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-k">else</span><span class="tok-w"> </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_state</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">AppState</span><span class="tok-o">::</span><span class="tok-n">RocketState</span><span class="tok-o">::</span><span class="tok-n">Launched</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_ROCKET</span><span class="tok-w"> </span><span class="tok-s">&quot; Rocket launched&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Reset Rocket&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_state</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">AppState</span><span class="tok-o">::</span><span class="tok-n">RocketState</span><span class="tok-o">::</span><span class="tok-n">Init</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">rocket_progress</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.f</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;Look at the status bar after clicking&quot;</span><span class="tok-p">);</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoDockingFlags</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Main dock space node flags&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">TextWrapped</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">This will edit the ImGuiDockNodeFlags for &quot;MainDockSpace&quot;.</span>
<span class="tok-s">Most flags are inherited by children dock spaces.</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">struct</span><span class="tok-w"> </span><span class="tok-nc">DockFlagWithInfo</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ImGuiDockNodeFlags</span><span class="tok-w"> </span><span class="tok-n">flag</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">label</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">tip</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">DockFlagWithInfo</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">all_flags</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiDockNodeFlags_NoDockingSplit</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;NoSplit&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;prevent Dock Nodes from being split&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiDockNodeFlags_NoResize</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;NoResize&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;prevent Dock Nodes from being resized&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiDockNodeFlags_AutoHideTabBar</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;AutoHideTabBar&quot;</span><span class="tok-p">,</span>
<span class="tok-w">         </span><span class="tok-s">&quot;show tab bar only if multiple windows</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">         </span><span class="tok-s">&quot;You will need to restore the layout after changing (Menu </span><span class="tok-se">\&quot;</span><span class="tok-s">View/Restore Layout</span><span class="tok-se">\&quot;</span><span class="tok-s">)&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiDockNodeFlags_NoDockingOverCentralNode</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;NoDockingInCentralNode&quot;</span><span class="tok-p">,</span>
<span class="tok-w">         </span><span class="tok-s">&quot;prevent docking in central node</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">         </span><span class="tok-s">&quot;(only works with the main dock space)&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-c1">// {ImGuiDockNodeFlags_PassthruCentralNode, &quot;PassthruCentralNode&quot;, &quot;advanced&quot;},</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">mainDockSpaceNodeFlags</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetRunnerParams</span><span class="tok-p">()</span><span class="tok-o">-&gt;</span><span class="tok-n">dockingParams</span><span class="tok-p">.</span><span class="tok-n">mainDockSpaceNodeFlags</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-k">auto</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">flag</span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-n">all_flags</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">CheckboxFlags</span><span class="tok-p">(</span><span class="tok-n">flag</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-p">.</span><span class="tok-n">c_str</span><span class="tok-p">(),</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">mainDockSpaceNodeFlags</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">flag</span><span class="tok-p">.</span><span class="tok-n">flag</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;%s&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">flag</span><span class="tok-p">.</span><span class="tok-n">tip</span><span class="tok-p">.</span><span class="tok-n">c_str</span><span class="tok-p">());</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">GuiWindowLayoutCustomization</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Switch between layouts&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;with the menu </span><span class="tok-se">\&quot;</span><span class="tok-s">View/Layouts</span><span class="tok-se">\&quot;</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;Each layout remembers separately the modifications applied by the user, </span><span class="tok-se">\n</span><span class="tok-s">and the selected layout is restored at startup&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Change the theme&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;with the menu </span><span class="tok-se">\&quot;</span><span class="tok-s">View/Theme</span><span class="tok-se">\&quot;</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;The selected theme is remembered and restored at startup&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoDockingFlags</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">GuiWindowAlternativeTheme</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// Since this window applies a theme, We need to call &quot;ImGui::Begin&quot; ourselves so</span>
<span class="tok-w">    </span><span class="tok-c1">// that we can apply the theme before opening the window.</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// In order to obtain this, we applied the following option to the window</span>
<span class="tok-w">    </span><span class="tok-c1">// that displays this Gui:</span>
<span class="tok-w">    </span><span class="tok-c1">//     alternativeThemeWindow.callBeginEnd = false;</span>

<span class="tok-w">    </span><span class="tok-c1">// Apply the theme before opening the window</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ImGuiTweakedTheme</span><span class="tok-w"> </span><span class="tok-n">tweakedTheme</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">tweakedTheme</span><span class="tok-p">.</span><span class="tok-n">Theme</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ImGuiTheme_WhiteIsWhite</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">tweakedTheme</span><span class="tok-p">.</span><span class="tok-n">Tweaks</span><span class="tok-p">.</span><span class="tok-n">Rounding</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.0f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">PushTweakedTheme</span><span class="tok-p">(</span><span class="tok-n">tweakedTheme</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-c1">// Open the window</span>
<span class="tok-w">    </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">windowOpened</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Begin</span><span class="tok-p">(</span><span class="tok-s">&quot;Alternative Theme&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">windowOpened</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-c1">// Display some widgets</span>
<span class="tok-w">        </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Alternative Theme&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;This window uses a different theme&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetItemTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;    ImGuiTheme::ImGuiTweakedTheme tweakedTheme;</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">                              </span><span class="tok-s">&quot;    tweakedTheme.Theme = ImGuiTheme::ImGuiTheme_WhiteIsWhite;</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">                              </span><span class="tok-s">&quot;    tweakedTheme.Tweaks.Rounding = 0.0f;</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">                              </span><span class="tok-s">&quot;    ImGuiTheme::PushTweakedTheme(tweakedTheme);&quot;</span><span class="tok-p">);</span>

<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">CollapsingHeader</span><span class="tok-p">(</span><span class="tok-s">&quot;Basic Widgets&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImGuiTreeNodeFlags_DefaultOpen</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">checked</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Checkbox</span><span class="tok-p">(</span><span class="tok-s">&quot;Checkbox&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">checked</span><span class="tok-p">);</span>

<span class="tok-w">            </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Button&quot;</span><span class="tok-p">))</span>
<span class="tok-w">                </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Button was pressed&quot;</span><span class="tok-p">);</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetItemTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;This is a button&quot;</span><span class="tok-p">);</span>

<span class="tok-w">            </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">radio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">RadioButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Radio 1&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">radio</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">RadioButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Radio 2&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">radio</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">1</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">RadioButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Radio 3&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">radio</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">2</span><span class="tok-p">);</span>

<span class="tok-w">            </span><span class="tok-c1">// Haiku</span>
<span class="tok-w">            </span><span class="tok-p">{</span>
<span class="tok-w">                </span><span class="tok-c1">// Display a image of the haiku below with Japanese characters</span>
<span class="tok-w">                </span><span class="tok-c1">// with an informative tooltip</span>
<span class="tok-w">                </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">haikuImageHeight</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">(</span><span class="tok-mf">5.f</span><span class="tok-p">);</span>
<span class="tok-w">                </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">ImageFromAsset</span><span class="tok-p">(</span><span class="tok-s">&quot;images/haiku.png&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImVec2</span><span class="tok-p">(</span><span class="tok-mf">0.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">haikuImageHeight</span><span class="tok-p">));</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetItemTooltip</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">Extract from Wikipedia</span>
<span class="tok-s">-------------------------------------------------------------------------------</span>

<span class="tok-s">In early 1686, Bashō composed one of his best-remembered haiku:</span>

<span class="tok-s">        furu ike ya / kawazu tobikomu / mizu no oto</span>

<span class="tok-s">   an ancient pond / a frog jumps in / the splash of water</span>

<span class="tok-s">This poem became instantly famous.</span>

<span class="tok-s">-------------------------------------------------------------------------------</span>

<span class="tok-s">This haiku is here rendered as an image, mainly to preserve space,</span>
<span class="tok-s">because adding a Japanese font to the project would enlarge its size.</span>
<span class="tok-s">Handling Japanese font is of course possible within ImGui / Hello ImGui!</span>
<span class="tok-s">            </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>

<span class="tok-w">                </span><span class="tok-c1">// Display the haiku text as an InputTextMultiline</span>
<span class="tok-w">                </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">poem</span><span class="tok-w"> </span><span class="tok-o">=</span>
<span class="tok-w">                    </span><span class="tok-s">&quot;   Old Pond</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">                    </span><span class="tok-s">&quot;  Frog Leaps In</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">                    </span><span class="tok-s">&quot; Water&#39;s Sound</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">                    </span><span class="tok-s">&quot;</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">                    </span><span class="tok-s">&quot;      Matsuo Bashō - 1686&quot;</span><span class="tok-p">;</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">InputTextMultiline</span><span class="tok-p">(</span><span class="tok-s">&quot;##Poem&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">poem</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmToVec2</span><span class="tok-p">(</span><span class="tok-mf">15.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">5.5f</span><span class="tok-p">));</span>
<span class="tok-w">            </span><span class="tok-p">}</span>

<span class="tok-w">            </span><span class="tok-c1">// A popup with a modal window</span>
<span class="tok-w">            </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Open Modal&quot;</span><span class="tok-p">))</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">OpenPopup</span><span class="tok-p">(</span><span class="tok-s">&quot;MyModal&quot;</span><span class="tok-p">);</span>
<span class="tok-w">            </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginPopupModal</span><span class="tok-p">(</span><span class="tok-s">&quot;MyModal&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-nb">NULL</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImGuiWindowFlags_AlwaysAutoResize</span><span class="tok-p">))</span>
<span class="tok-w">            </span><span class="tok-p">{</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;This is a modal window&quot;</span><span class="tok-p">);</span>
<span class="tok-w">                </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Close&quot;</span><span class="tok-p">))</span>
<span class="tok-w">                    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">CloseCurrentPopup</span><span class="tok-p">();</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndPopup</span><span class="tok-p">();</span>
<span class="tok-w">            </span><span class="tok-p">}</span>

<span class="tok-w">            </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">text</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Hello, world!&quot;</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">InputText</span><span class="tok-p">(</span><span class="tok-s">&quot;Input text&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">text</span><span class="tok-p">);</span>

<span class="tok-w">            </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">TreeNode</span><span class="tok-p">(</span><span class="tok-s">&quot;Text Display&quot;</span><span class="tok-p">))</span>
<span class="tok-w">            </span><span class="tok-p">{</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Hello, world!&quot;</span><span class="tok-p">);</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">TextColored</span><span class="tok-p">(</span><span class="tok-n">ImVec4</span><span class="tok-p">(</span><span class="tok-mf">1.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.5f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.5f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">1.f</span><span class="tok-p">),</span><span class="tok-w"> </span><span class="tok-s">&quot;Some text&quot;</span><span class="tok-p">);</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">TextDisabled</span><span class="tok-p">(</span><span class="tok-s">&quot;Disabled text&quot;</span><span class="tok-p">);</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">TextWrapped</span><span class="tok-p">(</span><span class="tok-s">&quot;This is a long text that will be wrapped in the window&quot;</span><span class="tok-p">);</span>
<span class="tok-w">                </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">TreePop</span><span class="tok-p">();</span>
<span class="tok-w">            </span><span class="tok-p">}</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-c1">// Close the window</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">End</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-c1">// Restore the theme</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">PopTweakedTheme</span><span class="tok-p">();</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoAssets</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Image From Asset&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">BeginGroupColumn</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Dummy</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmToVec2</span><span class="tok-p">(</span><span class="tok-mf">0.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.45f</span><span class="tok-p">));</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Hello&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EndGroupColumn</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">ImageFromAsset</span><span class="tok-p">(</span><span class="tok-s">&quot;images/world.png&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmToVec2</span><span class="tok-p">(</span><span class="tok-mf">2.5f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">2.5f</span><span class="tok-p">));</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoFonts</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Fonts - &quot;</span><span class="tok-w"> </span><span class="tok-n">ICON_FA_ROCKET</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">TextWrapped</span><span class="tok-p">(</span><span class="tok-s">&quot;Mix icons &quot;</span><span class="tok-w"> </span><span class="tok-n">ICON_FA_FACE_SMILE</span><span class="tok-w"> </span><span class="tok-s">&quot; and text &quot;</span><span class="tok-w"> </span><span class="tok-n">ICON_FA_ROCKET</span><span class="tok-w"> </span><span class="tok-s">&quot;&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;Example with Font Awesome Icons&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Emojis&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">EmojiFont</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-c1">// ✌️ (Victory Hand Emoji)</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-n">U8_TO_CHAR</span><span class="tok-p">(</span><span class="tok-sa">u8</span><span class="tok-s">&quot;</span><span class="tok-se">\U0000270C\U0000FE0F</span><span class="tok-s">&quot;</span><span class="tok-p">));</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">        </span><span class="tok-c1">// ❤️ (Red Heart Emoji)</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-n">U8_TO_CHAR</span><span class="tok-p">(</span><span class="tok-sa">u8</span><span class="tok-s">&quot;</span><span class="tok-se">\U00002764\U0000FE0F</span><span class="tok-s">&quot;</span><span class="tok-p">));</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-cp">#ifdef IMGUI_USE_WCHAR32</span>
<span class="tok-w">        </span><span class="tok-c1">// 🌴 (Palm Tree Emoji)</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-n">U8_TO_CHAR</span><span class="tok-p">(</span><span class="tok-sa">u8</span><span class="tok-s">&quot;</span><span class="tok-se">\U0001F334</span><span class="tok-s">&quot;</span><span class="tok-p">));</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">        </span><span class="tok-c1">// 🚀 (Rocket Emoji)</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-n">U8_TO_CHAR</span><span class="tok-p">(</span><span class="tok-sa">u8</span><span class="tok-s">&quot;</span><span class="tok-se">\U0001F680</span><span class="tok-s">&quot;</span><span class="tok-p">));</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-cp">#endif</span>

<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;Example with NotoEmoji font&quot;</span><span class="tok-p">);</span>

<span class="tok-cp">#ifdef IMGUI_ENABLE_FREETYPE</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Colored Fonts&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">ColorFont</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;COLOR!&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;Example with Playbox-FREE.otf font&quot;</span><span class="tok-p">);</span>
<span class="tok-cp">#endif</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">DemoThemes</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">TitleFont</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Themes&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">tweakedTheme</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetRunnerParams</span><span class="tok-p">()</span><span class="tok-o">-&gt;</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">tweakedTheme</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImVec2</span><span class="tok-w"> </span><span class="tok-n">buttonSize</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmToVec2</span><span class="tok-p">(</span><span class="tok-mf">7.f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.f</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Cherry&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">buttonSize</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">tweakedTheme</span><span class="tok-p">.</span><span class="tok-n">Theme</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ImGuiTheme_Cherry</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ApplyTweakedTheme</span><span class="tok-p">(</span><span class="tok-n">tweakedTheme</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;DarculaDarker&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">buttonSize</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">tweakedTheme</span><span class="tok-p">.</span><span class="tok-n">Theme</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ImGuiTheme_DarculaDarker</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ApplyTweakedTheme</span><span class="tok-p">(</span><span class="tok-n">tweakedTheme</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span>
<span class="tok-w">                </span><span class="tok-s">&quot;There are lots of other themes: look at the menu View/Theme</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">                </span><span class="tok-s">&quot;The selected theme is remembered and restored at startup&quot;</span>
<span class="tok-w">            </span><span class="tok-p">);</span>
<span class="tok-p">}</span>

<span class="tok-c1">// The Gui of the demo feature window</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">GuiWindowDemoFeatures</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">DemoFonts</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoAssets</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoLogs</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoRocket</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoUserSettings</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoHideWindow</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoShowAdditionalWindow</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoThemes</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-p">}</span>

<span class="tok-c1">// The Gui of the status bar</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">StatusBarGui</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">app_state</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">.</span><span class="tok-n">rocket_state</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">AppState</span><span class="tok-o">::</span><span class="tok-n">RocketState</span><span class="tok-o">::</span><span class="tok-n">Preparing</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Rocket completion: &quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">ProgressBar</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">.</span><span class="tok-n">rocket_progress</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmToVec2</span><span class="tok-p">(</span><span class="tok-mf">7.0f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">1.0f</span><span class="tok-p">));</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-p">}</span>

<span class="tok-c1">// The menu gui</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">ShowMenuGui</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">RunnerParams</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">runnerParams</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">ShowAppMenu</span><span class="tok-p">(</span><span class="tok-n">runnerParams</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">ShowViewMenu</span><span class="tok-p">(</span><span class="tok-n">runnerParams</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginMenu</span><span class="tok-p">(</span><span class="tok-s">&quot;My Menu&quot;</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">clicked</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">MenuItem</span><span class="tok-p">(</span><span class="tok-s">&quot;Test me&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">clicked</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Warning</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;It works&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndMenu</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">ShowAppMenuItems</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">MenuItem</span><span class="tok-p">(</span><span class="tok-s">&quot;A Custom app menu item&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Clicked on A Custom app menu item&quot;</span><span class="tok-p">);</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">ShowTopToolbar</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">LargeIconFont</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_POWER_OFF</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetRunnerParams</span><span class="tok-p">()</span><span class="tok-o">-&gt;</span><span class="tok-n">appShallExit</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetWindowWidth</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">-</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">(</span><span class="tok-mf">7.f</span><span class="tok-p">));</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_HOUSE</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Clicked on Home in the top toolbar&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_FLOPPY_DISK</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Clicked on Save in the top toolbar&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_ADDRESS_BOOK</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Clicked on Address Book in the top toolbar&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetWindowWidth</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">-</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">(</span><span class="tok-mf">2.f</span><span class="tok-p">));</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_BATTERY_THREE_QUARTERS</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-p">}</span>

<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">ShowRightToolbar</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">PushFontWithDefaultSize</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">LargeIconFont</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_CIRCLE_ARROW_LEFT</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Clicked on Circle left in the right toolbar&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_CIRCLE_ARROW_RIGHT</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-o">::</span><span class="tok-n">Info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Clicked on Circle right in the right toolbar&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-p">}</span>

<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">//    Docking Layouts and Docking windows</span>
<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>

<span class="tok-c1">//</span>
<span class="tok-c1">// 1. Define the Docking splits (two versions are available)</span>
<span class="tok-c1">//</span>
<span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">CreateDefaultDockingSplits</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">//    Define the default docking splits,</span>
<span class="tok-w">    </span><span class="tok-c1">//    i.e. the way the screen space is split in different target zones for the dockable windows</span>
<span class="tok-w">    </span><span class="tok-c1">//     We want to split &quot;MainDockSpace&quot; (which is provided automatically) into three zones, like this:</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">//    ___________________________________________</span>
<span class="tok-w">    </span><span class="tok-c1">//    |        |                                |</span>
<span class="tok-w">    </span><span class="tok-c1">//    | Command|                                |</span>
<span class="tok-w">    </span><span class="tok-c1">//    | Space  |    MainDockSpace               |</span>
<span class="tok-w">    </span><span class="tok-c1">//    |------- |                                |</span>
<span class="tok-w">    </span><span class="tok-c1">//    |        |--------------------------------|</span>
<span class="tok-w">    </span><span class="tok-c1">//    |        |       CommandSpace2            |</span>
<span class="tok-w">    </span><span class="tok-c1">//    -------------------------------------------</span>
<span class="tok-w">    </span><span class="tok-c1">//    |     MiscSpace                           |</span>
<span class="tok-w">    </span><span class="tok-c1">//    -------------------------------------------</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>

<span class="tok-w">    </span><span class="tok-c1">// Then, add a space named &quot;MiscSpace&quot; whose height is 25% of the app height.</span>
<span class="tok-w">    </span><span class="tok-c1">// This will split the preexisting default dockspace &quot;MainDockSpace&quot; in two parts.</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-w"> </span><span class="tok-n">splitMainMisc</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainMisc</span><span class="tok-p">.</span><span class="tok-n">initialDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainMisc</span><span class="tok-p">.</span><span class="tok-n">newDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MiscSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainMisc</span><span class="tok-p">.</span><span class="tok-n">direction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiDir_Down</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainMisc</span><span class="tok-p">.</span><span class="tok-n">ratio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.25f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Then, add a space to the left which occupies a column whose width is 25% of the app width</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-w"> </span><span class="tok-n">splitMainCommand</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand</span><span class="tok-p">.</span><span class="tok-n">initialDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand</span><span class="tok-p">.</span><span class="tok-n">newDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;CommandSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand</span><span class="tok-p">.</span><span class="tok-n">direction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiDir_Left</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand</span><span class="tok-p">.</span><span class="tok-n">ratio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.25f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Then, add CommandSpace2 below MainDockSpace</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-w"> </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">.</span><span class="tok-n">initialDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">.</span><span class="tok-n">newDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;CommandSpace2&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">.</span><span class="tok-n">direction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiDir_Down</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">.</span><span class="tok-n">ratio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.5f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">splits</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-n">splitMainMisc</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">splitMainCommand</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">splits</span><span class="tok-p">;</span>
<span class="tok-p">}</span>

<span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">CreateAlternativeDockingSplits</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">//    Define alternative docking splits for the &quot;Alternative Layout&quot;</span>
<span class="tok-w">    </span><span class="tok-c1">//    ___________________________________________</span>
<span class="tok-w">    </span><span class="tok-c1">//    |                |                        |</span>
<span class="tok-w">    </span><span class="tok-c1">//    | Misc           |                        |</span>
<span class="tok-w">    </span><span class="tok-c1">//    | Space          |    MainDockSpace       |</span>
<span class="tok-w">    </span><span class="tok-c1">//    |                |                        |</span>
<span class="tok-w">    </span><span class="tok-c1">//    -------------------------------------------</span>
<span class="tok-w">    </span><span class="tok-c1">//    |                       |                 |</span>
<span class="tok-w">    </span><span class="tok-c1">//    |                       | Command         |</span>
<span class="tok-w">    </span><span class="tok-c1">//    |     CommandSpace      | Space2          |</span>
<span class="tok-w">    </span><span class="tok-c1">//    |                       |                 |</span>
<span class="tok-w">    </span><span class="tok-c1">//    -------------------------------------------</span>

<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-w"> </span><span class="tok-n">splitMainCommand</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand</span><span class="tok-p">.</span><span class="tok-n">initialDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand</span><span class="tok-p">.</span><span class="tok-n">newDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;CommandSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand</span><span class="tok-p">.</span><span class="tok-n">direction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiDir_Down</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand</span><span class="tok-p">.</span><span class="tok-n">ratio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.5f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-w"> </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">.</span><span class="tok-n">initialDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;CommandSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">.</span><span class="tok-n">newDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;CommandSpace2&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">.</span><span class="tok-n">direction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiDir_Right</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">.</span><span class="tok-n">ratio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.4f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-w"> </span><span class="tok-n">splitMainMisc</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainMisc</span><span class="tok-p">.</span><span class="tok-n">initialDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainMisc</span><span class="tok-p">.</span><span class="tok-n">newDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MiscSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainMisc</span><span class="tok-p">.</span><span class="tok-n">direction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiDir_Left</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainMisc</span><span class="tok-p">.</span><span class="tok-n">ratio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.5f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">splits</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-n">splitMainCommand</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">splitMainCommand2</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">splitMainMisc</span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">splits</span><span class="tok-p">;</span>
<span class="tok-p">}</span>

<span class="tok-c1">//</span>
<span class="tok-c1">// 2. Define the Dockable windows</span>
<span class="tok-c1">//</span>
<span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">CreateDockableWindows</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// A window named &quot;FeaturesDemo&quot; will be placed in &quot;CommandSpace&quot;. Its Gui is provided by &quot;GuiWindowDemoFeatures&quot;</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">featuresDemoWindow</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">featuresDemoWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Features Demo&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">featuresDemoWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;CommandSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">featuresDemoWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-p">]</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">GuiWindowDemoFeatures</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-c1">// A layout customization window will be placed in &quot;MainDockSpace&quot;. Its Gui is provided by &quot;GuiWindowLayoutCustomization&quot;</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">layoutCustomizationWindow</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">layoutCustomizationWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Layout customization&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">layoutCustomizationWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">layoutCustomizationWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">GuiWindowLayoutCustomization</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-c1">// A Log window named &quot;Logs&quot; will be placed in &quot;MiscSpace&quot;. It uses the HelloImGui logger gui</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">logsWindow</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">logsWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Logs&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">logsWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MiscSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">logsWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogGui</span><span class="tok-p">();</span><span class="tok-w"> </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-c1">// A Window named &quot;Dear ImGui Demo&quot; will be placed in &quot;MainDockSpace&quot;</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">.</span><span class="tok-n">imGuiWindowFlags</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiWindowFlags_MenuBar</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">ShowDemoWindow</span><span class="tok-p">();</span><span class="tok-w"> </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-c1">// alternativeThemeWindow</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">alternativeThemeWindow</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-c1">// Since this window applies a theme, We need to call &quot;ImGui::Begin&quot; ourselves so</span>
<span class="tok-w">    </span><span class="tok-c1">// that we can apply the theme before opening the window.</span>
<span class="tok-w">    </span><span class="tok-n">alternativeThemeWindow</span><span class="tok-p">.</span><span class="tok-n">callBeginEnd</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">alternativeThemeWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Alternative Theme&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">alternativeThemeWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;CommandSpace2&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">alternativeThemeWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">GuiWindowAlternativeTheme</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">dockableWindows</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">featuresDemoWindow</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-n">layoutCustomizationWindow</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-n">logsWindow</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-n">alternativeThemeWindow</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">dockableWindows</span><span class="tok-p">;</span>
<span class="tok-p">}</span>

<span class="tok-c1">//</span>
<span class="tok-c1">// 3. Define the layouts:</span>
<span class="tok-c1">//        A layout is stored inside DockingParams, and stores the splits + the dockable windows.</span>
<span class="tok-c1">//        Here, we provide the default layout, and two alternative layouts.</span>
<span class="tok-c1">//</span>
<span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingParams</span><span class="tok-w"> </span><span class="tok-n">CreateDefaultLayout</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingParams</span><span class="tok-w"> </span><span class="tok-n">dockingParams</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-c1">// dockingParams.layoutName = &quot;Default&quot;; // By default, the layout name is already &quot;Default&quot;</span>
<span class="tok-w">    </span><span class="tok-n">dockingParams</span><span class="tok-p">.</span><span class="tok-n">dockingSplits</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateDefaultDockingSplits</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">dockingParams</span><span class="tok-p">.</span><span class="tok-n">dockableWindows</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateDockableWindows</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">dockingParams</span><span class="tok-p">;</span>
<span class="tok-p">}</span>

<span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingParams</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">CreateAlternativeLayouts</span><span class="tok-p">(</span><span class="tok-n">AppState</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingParams</span><span class="tok-w"> </span><span class="tok-n">alternativeLayout</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">alternativeLayout</span><span class="tok-p">.</span><span class="tok-n">layoutName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Alternative Layout&quot;</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">alternativeLayout</span><span class="tok-p">.</span><span class="tok-n">dockingSplits</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateAlternativeDockingSplits</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">alternativeLayout</span><span class="tok-p">.</span><span class="tok-n">dockableWindows</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateDockableWindows</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingParams</span><span class="tok-w"> </span><span class="tok-n">tabsLayout</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">tabsLayout</span><span class="tok-p">.</span><span class="tok-n">layoutName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Tabs Layout&quot;</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">tabsLayout</span><span class="tok-p">.</span><span class="tok-n">dockableWindows</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateDockableWindows</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-c1">// Force all windows to be presented in the MainDockSpace</span>
<span class="tok-w">        </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">auto</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">window</span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-n">tabsLayout</span><span class="tok-p">.</span><span class="tok-n">dockableWindows</span><span class="tok-p">)</span>
<span class="tok-w">            </span><span class="tok-n">window</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-c1">// In &quot;Tabs Layout&quot;, no split is created</span>
<span class="tok-w">        </span><span class="tok-n">tabsLayout</span><span class="tok-p">.</span><span class="tok-n">dockingSplits</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">{};</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-n">alternativeLayout</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">tabsLayout</span><span class="tok-p">};</span>
<span class="tok-p">}</span>


<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">// Define the app initial theme</span>
<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">SetupMyTheme</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// Example of theme customization at App startup</span>
<span class="tok-w">    </span><span class="tok-c1">// This function is called in the callback `SetupImGuiStyle` in order to apply a custom theme:</span>
<span class="tok-w">    </span><span class="tok-c1">//     runnerParams.callbacks.SetupImGuiStyle = SetupMyTheme;</span>

<span class="tok-w">    </span><span class="tok-c1">// Apply default style</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">ImGuiDefaultSettings</span><span class="tok-o">::</span><span class="tok-n">SetupDefaultImGuiStyle</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-c1">// Create a tweaked theme</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ImGuiTweakedTheme</span><span class="tok-w"> </span><span class="tok-n">tweakedTheme</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">tweakedTheme</span><span class="tok-p">.</span><span class="tok-n">Theme</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ImGuiTheme_MaterialFlat</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">tweakedTheme</span><span class="tok-p">.</span><span class="tok-n">Tweaks</span><span class="tok-p">.</span><span class="tok-n">Rounding</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">10.0f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-c1">// Apply the tweaked theme</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiTheme</span><span class="tok-o">::</span><span class="tok-n">ApplyTweakedTheme</span><span class="tok-p">(</span><span class="tok-n">tweakedTheme</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-c1">// Note: you can also push/pop the theme in order to apply it only to a specific part of the Gui: ImGuiTheme::PushTweakedTheme(tweakedTheme) / ImGuiTheme::PopTweakedTheme()</span>
<span class="tok-w">    </span><span class="tok-c1">// Then apply further modifications to ImGui style</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetStyle</span><span class="tok-p">().</span><span class="tok-n">ItemSpacing</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImVec2</span><span class="tok-p">(</span><span class="tok-mi">6</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">4</span><span class="tok-p">);</span><span class="tok-w">  </span><span class="tok-c1">// Reduce spacing between items ((8, 4) by default)</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetStyle</span><span class="tok-p">().</span><span class="tok-n">Colors</span><span class="tok-p">[</span><span class="tok-n">ImGuiCol_Text</span><span class="tok-p">]</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImVec4</span><span class="tok-p">(</span><span class="tok-mf">0.8</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.8</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.85</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">1.0</span><span class="tok-p">);</span><span class="tok-w">  </span><span class="tok-c1">// Change text color</span>
<span class="tok-p">}</span>


<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">//    main(): here, we simply fill RunnerParams, then run the application</span>
<span class="tok-c1">//////////////////////////////////////////////////////////////////////////</span>
<span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">main</span><span class="tok-p">(</span><span class="tok-kt">int</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-kt">char</span><span class="tok-o">**</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">ChdirBesideAssetsFolder</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-c1">//#############################################################################################</span>
<span class="tok-w">    </span><span class="tok-c1">// Part 1: Define the application state, fill the status and menu bars, load additional font</span>
<span class="tok-w">    </span><span class="tok-c1">//#############################################################################################</span>

<span class="tok-w">    </span><span class="tok-c1">// Our application state</span>
<span class="tok-w">    </span><span class="tok-n">AppState</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Hello ImGui params (they hold the settings as well as the Gui callbacks)</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">RunnerParams</span><span class="tok-w"> </span><span class="tok-n">runnerParams</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">windowTitle</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Docking Demo&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">menuAppTitle</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Docking Demo&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">windowGeometry</span><span class="tok-p">.</span><span class="tok-n">size</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-mi">1000</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">900</span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">restorePreviousGeometry</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">borderless</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">borderlessMovable</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">borderlessResizable</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">borderlessClosable</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Set LoadAdditionalFonts callback</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">LoadAdditionalFonts</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">LoadFonts</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// Status bar</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// We use the default status bar of Hello ImGui</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">showStatusBar</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-c1">// Add custom widgets in the status bar</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">ShowStatus</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">StatusBarGui</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-c1">// uncomment next line in order to hide the FPS in the status bar</span>
<span class="tok-w">    </span><span class="tok-c1">// runnerParams.imGuiWindowParams.showStatusFps = false;</span>

<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// Menu bar</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// Here, we fully customize the menu bar:</span>
<span class="tok-w">    </span><span class="tok-c1">// by setting `showMenuBar` to true, and `showMenu_App` and `showMenu_View` to false,</span>
<span class="tok-w">    </span><span class="tok-c1">// HelloImGui will display an empty menu bar, which we can fill with our own menu items via the callback `ShowMenus`</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">showMenuBar</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">showMenu_App</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">showMenu_View</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-c1">// Inside `ShowMenus`, we can call `HelloImGui::ShowViewMenu` and `HelloImGui::ShowAppMenu` if desired</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">ShowMenus</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">runnerParams</span><span class="tok-p">]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-n">ShowMenuGui</span><span class="tok-p">(</span><span class="tok-n">runnerParams</span><span class="tok-p">);};</span>
<span class="tok-w">    </span><span class="tok-c1">// Optional: add items to Hello ImGui default App menu</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">ShowAppMenuItems</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ShowAppMenuItems</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// Top and bottom toolbars</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// toolbar options</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EdgeToolbarOptions</span><span class="tok-w"> </span><span class="tok-n">edgeToolbarOptions</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">edgeToolbarOptions</span><span class="tok-p">.</span><span class="tok-n">sizeEm</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">2.5f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">edgeToolbarOptions</span><span class="tok-p">.</span><span class="tok-n">WindowBg</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImVec4</span><span class="tok-p">(</span><span class="tok-mf">0.8f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.8f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.8f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.35f</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-c1">// top toolbar</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">AddEdgeToolbar</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EdgeToolbarType</span><span class="tok-o">::</span><span class="tok-n">Top</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">ShowTopToolbar</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-n">edgeToolbarOptions</span>
<span class="tok-w">    </span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-c1">// right toolbar</span>
<span class="tok-w">    </span><span class="tok-n">edgeToolbarOptions</span><span class="tok-p">.</span><span class="tok-n">WindowBg</span><span class="tok-p">.</span><span class="tok-n">w</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.4f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">AddEdgeToolbar</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EdgeToolbarType</span><span class="tok-o">::</span><span class="tok-n">Right</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">ShowRightToolbar</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-n">edgeToolbarOptions</span>
<span class="tok-w">    </span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// Load user settings at callbacks `PostInit` and save them at `BeforeExit`</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">PostInit</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">]</span><span class="tok-w">   </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">LoadMyAppSettings</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);};</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">BeforeExit</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">]</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">SaveMyAppSettings</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);};</span>

<span class="tok-w">    </span><span class="tok-c1">// Change style</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">SetupImGuiStyle</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">SetupMyTheme</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">//#############################################################################################</span>
<span class="tok-w">    </span><span class="tok-c1">// Part 2: Define the application layout and windows</span>
<span class="tok-w">    </span><span class="tok-c1">//#############################################################################################</span>

<span class="tok-w">    </span><span class="tok-c1">// First, tell HelloImGui that we want full screen dock space (this will create &quot;MainDockSpace&quot;)</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">defaultImGuiWindowType</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DefaultImGuiWindowType</span><span class="tok-o">::</span><span class="tok-n">ProvideFullScreenDockSpace</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-c1">// In this demo, we also demonstrate multiple viewports: you can drag windows outside out the main window in order to put their content into new native windows</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">enableViewports</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-c1">// Set the default layout (this contains the default DockingSplits and DockableWindows)</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">dockingParams</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateDefaultLayout</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-c1">// Add alternative layouts</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">alternativeDockingLayouts</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateAlternativeLayouts</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-c1">// uncomment the next line if you want to always start with the layout defined in the code</span>
<span class="tok-w">    </span><span class="tok-c1">//     (otherwise, modifications to the layout applied by the user layout will be remembered)</span>
<span class="tok-w">    </span><span class="tok-c1">// runnerParams.dockingParams.layoutCondition = HelloImGui::DockingLayoutCondition::ApplicationStart;</span>

<span class="tok-w">    </span><span class="tok-c1">//#############################################################################################</span>
<span class="tok-w">    </span><span class="tok-c1">// Part 3: Where to save the app settings</span>
<span class="tok-w">    </span><span class="tok-c1">//#############################################################################################</span>
<span class="tok-w">    </span><span class="tok-c1">// tag::app_settings[]</span>
<span class="tok-w">    </span><span class="tok-c1">// By default, HelloImGui will save the settings in the current folder.</span>
<span class="tok-w">    </span><span class="tok-c1">// This is convenient when developing, but not so much when deploying the app.</span>
<span class="tok-w">    </span><span class="tok-c1">// You can tell HelloImGui to save the settings in a specific folder: choose between</span>
<span class="tok-w">    </span><span class="tok-c1">//         CurrentFolder</span>
<span class="tok-w">    </span><span class="tok-c1">//         AppUserConfigFolder</span>
<span class="tok-w">    </span><span class="tok-c1">//         AppExecutableFolder</span>
<span class="tok-w">    </span><span class="tok-c1">//         HomeFolder</span>
<span class="tok-w">    </span><span class="tok-c1">//         TempFolder</span>
<span class="tok-w">    </span><span class="tok-c1">//         DocumentsFolder</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// Note: AppUserConfigFolder is:</span>
<span class="tok-w">    </span><span class="tok-c1">//         AppData under Windows (Example: C:\Users\[Username]\AppData\Roaming)</span>
<span class="tok-w">    </span><span class="tok-c1">//         ~/.config under Linux</span>
<span class="tok-w">    </span><span class="tok-c1">//         &quot;~/Library/Application Support&quot; under macOS or iOS</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">iniFolderType</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">IniFolderType</span><span class="tok-o">::</span><span class="tok-n">AppUserConfigFolder</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// runnerParams.iniFilename: this will be the name of the ini file in which the settings</span>
<span class="tok-w">    </span><span class="tok-c1">// will be stored.</span>
<span class="tok-w">    </span><span class="tok-c1">// In this example, the subdirectory Docking_Demo will be created under the folder defined</span>
<span class="tok-w">    </span><span class="tok-c1">// by runnerParams.iniFolderType.</span>
<span class="tok-w">    </span><span class="tok-c1">//</span>
<span class="tok-w">    </span><span class="tok-c1">// Note: if iniFilename is left empty, the name of the ini file will be derived</span>
<span class="tok-w">    </span><span class="tok-c1">// from appWindowParams.windowTitle</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">iniFilename</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Docking_Demo/Docking_demo.ini&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-c1">// end::app_settings[]</span>


<span class="tok-w">    </span><span class="tok-c1">//#############################################################################################</span>
<span class="tok-w">    </span><span class="tok-c1">// Part 4: Run the app</span>
<span class="tok-w">    </span><span class="tok-c1">//#############################################################################################</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Run</span><span class="tok-p">(</span><span class="tok-n">runnerParams</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-c1">// Note: with ImGuiBundle, it is also possible to use ImmApp::Run(...)</span>


<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>
<span class="tok-p">}</span></code></pre>
</div>
</div>
</div>
</details>
<details>
<summary class="title">Click to see its source code in Python</summary>
<div class="content">
<div class="paragraph">
<p>Python:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="python"><span></span><span class="tok-c1"># A more complex app demo</span>
<span class="tok-c1">#</span>
<span class="tok-c1"># It demonstrates how to:</span>
<span class="tok-c1"># - set up a complex docking layouts (with several possible layouts):</span>
<span class="tok-c1"># - load additional fonts, possibly colored, and with emojis</span>
<span class="tok-c1"># - display a log window</span>
<span class="tok-c1"># - use the status bar</span>
<span class="tok-c1"># - use default menus (App and view menu), and how to customize them</span>
<span class="tok-c1"># - use a specific application state (instead of using static variables)</span>
<span class="tok-c1"># - save some additional user settings within imgui ini file</span>
<span class="tok-c1"># - use borderless windows, that are movable and resizable</span>
<span class="tok-kn">import</span> <span class="tok-nn">json</span>
<span class="tok-kn">from</span> <span class="tok-nn">enum</span> <span class="tok-kn">import</span> <span class="tok-n">Enum</span>
<span class="tok-kn">import</span> <span class="tok-nn">time</span>

<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">hello_imgui</span><span class="tok-p">,</span> <span class="tok-n">icons_fontawesome_6</span><span class="tok-p">,</span> <span class="tok-n">imgui</span><span class="tok-p">,</span> <span class="tok-n">immapp</span><span class="tok-p">,</span> <span class="tok-n">imgui_ctx</span><span class="tok-p">,</span> <span class="tok-n">ImVec4</span><span class="tok-p">,</span> <span class="tok-n">ImVec2</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle.demos_python</span> <span class="tok-kn">import</span> <span class="tok-n">demo_utils</span>
<span class="tok-kn">from</span> <span class="tok-nn">typing</span> <span class="tok-kn">import</span> <span class="tok-n">List</span><span class="tok-p">,</span> <span class="tok-n">Any</span>


<span class="tok-c1">##########################################################################</span>
<span class="tok-c1">#    Our Application State</span>
<span class="tok-c1">##########################################################################</span>
<span class="tok-k">class</span> <span class="tok-nc">MyAppSettings</span><span class="tok-p">:</span>
    <span class="tok-n">motto</span><span class="tok-p">:</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">InputTextData</span>
    <span class="tok-n">value</span><span class="tok-p">:</span> <span class="tok-nb">int</span> <span class="tok-o">=</span> <span class="tok-mi">10</span>

    <span class="tok-k">def</span> <span class="tok-fm">__init__</span><span class="tok-p">(</span><span class="tok-bp">self</span><span class="tok-p">):</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">motto</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">InputTextData</span><span class="tok-p">(</span>
            <span class="tok-s2">&quot;Hello, Dear ImGui</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span>
            <span class="tok-s2">&quot;Unleash your creativity!</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span><span class="tok-p">,</span>
            <span class="tok-kc">True</span><span class="tok-p">,</span> <span class="tok-c1"># multiline</span>
            <span class="tok-p">(</span><span class="tok-mf">14.0</span><span class="tok-p">,</span> <span class="tok-mf">3.0</span><span class="tok-p">)</span> <span class="tok-c1"># initial size (in em)</span>
        <span class="tok-p">)</span>

<span class="tok-k">class</span> <span class="tok-nc">RocketState</span><span class="tok-p">(</span><span class="tok-n">Enum</span><span class="tok-p">):</span>
    <span class="tok-n">Init</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>
    <span class="tok-n">Preparing</span> <span class="tok-o">=</span> <span class="tok-mi">1</span>
    <span class="tok-n">Launched</span> <span class="tok-o">=</span> <span class="tok-mi">2</span>


<span class="tok-c1"># Struct that holds the application&#39;s state</span>
<span class="tok-k">class</span> <span class="tok-nc">AppState</span><span class="tok-p">:</span>
    <span class="tok-n">f</span><span class="tok-p">:</span> <span class="tok-nb">float</span>
    <span class="tok-n">counter</span><span class="tok-p">:</span> <span class="tok-nb">int</span>
    <span class="tok-n">rocket_progress</span><span class="tok-p">:</span> <span class="tok-nb">float</span>
    <span class="tok-n">my_app_settings</span><span class="tok-p">:</span> <span class="tok-n">MyAppSettings</span>
    <span class="tok-n">rocket_state</span><span class="tok-p">:</span> <span class="tok-n">RocketState</span>
    <span class="tok-n">rocket_launch_time</span><span class="tok-p">:</span> <span class="tok-nb">float</span>

    <span class="tok-n">title_font</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">ImFont</span>
    <span class="tok-n">color_font</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">ImFont</span>
    <span class="tok-n">emoji_font</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">ImFont</span>
    <span class="tok-n">large_icon_font</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">ImFont</span>

    <span class="tok-k">def</span> <span class="tok-fm">__init__</span><span class="tok-p">(</span><span class="tok-bp">self</span><span class="tok-p">):</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">f</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">counter</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">rocket_progress</span> <span class="tok-o">=</span> <span class="tok-mf">0.0</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">rocket_launch_time</span> <span class="tok-o">=</span> <span class="tok-mf">0.0</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">my_app_settings</span> <span class="tok-o">=</span> <span class="tok-n">MyAppSettings</span><span class="tok-p">()</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">rocket_state</span> <span class="tok-o">=</span> <span class="tok-n">RocketState</span><span class="tok-o">.</span><span class="tok-n">Init</span>


<span class="tok-c1">##########################################################################</span>
<span class="tok-c1">#    Additional fonts handling</span>
<span class="tok-c1">##########################################################################</span>
<span class="tok-k">def</span> <span class="tok-nf">load_fonts</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>  <span class="tok-c1"># This is called by runnerParams.callbacks.LoadAdditionalFonts</span>
    <span class="tok-c1"># First, load the default font (the default font should be loaded first)</span>
    <span class="tok-c1"># In this example, we instruct HelloImGui to use FontAwesome6 instead of FontAwesome4</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_runner_params</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">default_icon_font</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DefaultIconFont</span><span class="tok-o">.</span><span class="tok-n">font_awesome6</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">imgui_default_settings</span><span class="tok-o">.</span><span class="tok-n">load_default_font_with_font_awesome_icons</span><span class="tok-p">()</span>

    <span class="tok-c1"># Load the title font</span>
    <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">load_font_ttf_with_font_awesome_icons</span><span class="tok-p">(</span><span class="tok-s2">&quot;fonts/Roboto/Roboto-BoldItalic.ttf&quot;</span><span class="tok-p">,</span> <span class="tok-mi">18</span><span class="tok-p">)</span>

    <span class="tok-c1"># Load the emoji font</span>
    <span class="tok-n">font_loading_params_emoji</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">FontLoadingParams</span><span class="tok-p">()</span>
    <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">emoji_font</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">load_font</span><span class="tok-p">(</span><span class="tok-s2">&quot;fonts/NotoEmoji-Regular.ttf&quot;</span><span class="tok-p">,</span> <span class="tok-mf">24.</span><span class="tok-p">,</span> <span class="tok-n">font_loading_params_emoji</span><span class="tok-p">)</span>

    <span class="tok-c1"># Load a large icon font</span>
    <span class="tok-n">font_loading_params_large_icon</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">FontLoadingParams</span><span class="tok-p">()</span>
    <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">large_icon_font</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">load_font</span><span class="tok-p">(</span><span class="tok-s2">&quot;fonts/fontawesome-webfont.ttf&quot;</span><span class="tok-p">,</span> <span class="tok-mf">24.</span><span class="tok-p">,</span> <span class="tok-n">font_loading_params_large_icon</span><span class="tok-p">)</span>

    <span class="tok-c1"># Load a colored font</span>
    <span class="tok-n">font_loading_params_color</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">FontLoadingParams</span><span class="tok-p">()</span>
    <span class="tok-n">font_loading_params_color</span><span class="tok-o">.</span><span class="tok-n">load_color</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">color_font</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">load_font</span><span class="tok-p">(</span><span class="tok-s2">&quot;fonts/Playbox/Playbox-FREE.otf&quot;</span><span class="tok-p">,</span> <span class="tok-mf">24.</span><span class="tok-p">,</span> <span class="tok-n">font_loading_params_color</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">font</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">ImFont</span><span class="tok-p">):</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">push_font</span><span class="tok-p">(</span><span class="tok-n">font</span><span class="tok-p">,</span> <span class="tok-n">font</span><span class="tok-o">.</span><span class="tok-n">legacy_size</span><span class="tok-p">)</span>



<span class="tok-c1">##########################################################################</span>
<span class="tok-c1">#    Save additional settings in the ini file</span>
<span class="tok-c1">##########################################################################</span>
<span class="tok-c1"># This demonstrates how to store additional info in the application settings</span>
<span class="tok-c1"># Use this sparingly!</span>
<span class="tok-c1"># This is provided as a convenience only, and it is not intended to store large quantities of text data.</span>

<span class="tok-c1"># Warning, the save/load function below are quite simplistic!</span>
<span class="tok-k">def</span> <span class="tok-nf">my_app_settings_to_string</span><span class="tok-p">(</span><span class="tok-n">settings</span><span class="tok-p">:</span> <span class="tok-n">MyAppSettings</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-nb">str</span><span class="tok-p">:</span>
    <span class="tok-n">as_dict</span><span class="tok-p">:</span> <span class="tok-nb">dict</span><span class="tok-p">[</span><span class="tok-nb">str</span><span class="tok-p">,</span> <span class="tok-n">Any</span><span class="tok-p">]</span> <span class="tok-o">=</span> <span class="tok-p">{}</span>
    <span class="tok-n">as_dict</span><span class="tok-p">[</span><span class="tok-s2">&quot;motto&quot;</span><span class="tok-p">]</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">input_text_data_to_dict</span><span class="tok-p">(</span><span class="tok-n">settings</span><span class="tok-o">.</span><span class="tok-n">motto</span><span class="tok-p">)</span>
    <span class="tok-n">as_dict</span><span class="tok-p">[</span><span class="tok-s2">&quot;value&quot;</span><span class="tok-p">]</span> <span class="tok-o">=</span> <span class="tok-n">settings</span><span class="tok-o">.</span><span class="tok-n">value</span>
    <span class="tok-k">return</span> <span class="tok-n">json</span><span class="tok-o">.</span><span class="tok-n">dumps</span><span class="tok-p">(</span><span class="tok-n">as_dict</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">string_to_my_app_settings</span><span class="tok-p">(</span><span class="tok-n">s</span><span class="tok-p">:</span> <span class="tok-nb">str</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-n">MyAppSettings</span><span class="tok-p">:</span>
    <span class="tok-n">r</span> <span class="tok-o">=</span> <span class="tok-n">MyAppSettings</span><span class="tok-p">()</span>
    <span class="tok-k">try</span><span class="tok-p">:</span>
        <span class="tok-n">as_dict</span> <span class="tok-o">=</span> <span class="tok-n">json</span><span class="tok-o">.</span><span class="tok-n">loads</span><span class="tok-p">(</span><span class="tok-n">s</span><span class="tok-p">)</span>
        <span class="tok-n">r</span><span class="tok-o">.</span><span class="tok-n">motto</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">input_text_data_from_dict</span><span class="tok-p">(</span><span class="tok-n">as_dict</span><span class="tok-p">[</span><span class="tok-s2">&quot;motto&quot;</span><span class="tok-p">])</span>
        <span class="tok-n">r</span><span class="tok-o">.</span><span class="tok-n">value</span> <span class="tok-o">=</span> <span class="tok-n">as_dict</span><span class="tok-p">[</span><span class="tok-s2">&quot;value&quot;</span><span class="tok-p">]</span>
    <span class="tok-k">except</span> <span class="tok-ne">Exception</span> <span class="tok-k">as</span> <span class="tok-n">e</span><span class="tok-p">:</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">error</span><span class="tok-p">,</span> <span class="tok-sa">f</span><span class="tok-s2">&quot;Error while loading user settings: </span><span class="tok-si">{</span><span class="tok-n">e</span><span class="tok-si">}</span><span class="tok-s2">&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">return</span> <span class="tok-n">r</span>


<span class="tok-k">def</span> <span class="tok-nf">load_my_app_settings</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
<span class="tok-w">    </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">    Note: load_my_app_settings() and save_my_app_settings() will be called in the callbacks `post_init` &amp; `before_exit`</span>
<span class="tok-sd">         runner_params.callbacks.post_init = lambda: load_user_settings(app_state)</span>
<span class="tok-sd">         runner_params.callbacks.before_exit = lambda: save_user_settings(app_state)</span>
<span class="tok-sd">    &quot;&quot;&quot;</span>
    <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">my_app_settings</span> <span class="tok-o">=</span> <span class="tok-n">string_to_my_app_settings</span><span class="tok-p">(</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">load_user_pref</span><span class="tok-p">(</span><span class="tok-s2">&quot;MyAppSettings&quot;</span><span class="tok-p">)</span>
    <span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">save_my_app_settings</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">save_user_pref</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;MyAppSettings&quot;</span><span class="tok-p">,</span> <span class="tok-n">my_app_settings_to_string</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">my_app_settings</span><span class="tok-p">)</span>
    <span class="tok-p">)</span>


<span class="tok-c1">##########################################################################</span>
<span class="tok-c1">#    Gui functions used in this demo</span>
<span class="tok-c1">##########################################################################</span>
<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span><span class="tok-n">last_hide_time</span><span class="tok-o">=</span><span class="tok-mi">1</span><span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_hide_window</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-c1"># Display a button that will hide the application window</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Hide app window&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Hide&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">demo_hide_window</span><span class="tok-o">.</span><span class="tok-n">last_hide_time</span> <span class="tok-o">=</span> <span class="tok-n">time</span><span class="tok-o">.</span><span class="tok-n">time</span><span class="tok-p">()</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_runner_params</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">hidden</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;By clicking this button, you can hide the window for 3 seconds.&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">demo_hide_window</span><span class="tok-o">.</span><span class="tok-n">last_hide_time</span> <span class="tok-o">&gt;</span> <span class="tok-mf">0.0</span><span class="tok-p">:</span>
        <span class="tok-n">now</span> <span class="tok-o">=</span> <span class="tok-n">time</span><span class="tok-o">.</span><span class="tok-n">time</span><span class="tok-p">()</span>
        <span class="tok-k">if</span> <span class="tok-n">now</span> <span class="tok-o">-</span> <span class="tok-n">demo_hide_window</span><span class="tok-o">.</span><span class="tok-n">last_hide_time</span> <span class="tok-o">&gt;</span> <span class="tok-mf">3.0</span><span class="tok-p">:</span>
            <span class="tok-n">demo_hide_window</span><span class="tok-o">.</span><span class="tok-n">last_hide_time</span> <span class="tok-o">=</span> <span class="tok-o">-</span><span class="tok-mf">1.0</span>
            <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_runner_params</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">hidden</span> <span class="tok-o">=</span> <span class="tok-kc">False</span>


<span class="tok-c1"># Display a button that will add another dockable window during execution</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_show_additional_window</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-c1"># In order to add a dockable window during execution, you should use</span>
    <span class="tok-c1">#     hello_imgui.add_dockable_window()</span>
    <span class="tok-c1"># Note: you should not modify manually the content of runnerParams.docking_params.dockable_windows</span>
    <span class="tok-c1">#       (since HelloImGui is constantly looping on it)</span>

    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Dynamically add window&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>

    <span class="tok-n">window_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Additional Window&quot;</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Show additional window&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">additional_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
        <span class="tok-n">additional_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-n">window_name</span>
        <span class="tok-n">additional_window</span><span class="tok-o">.</span><span class="tok-n">include_in_view_menu</span> <span class="tok-o">=</span> <span class="tok-kc">False</span>  <span class="tok-c1"># this window is not shown in the view menu,</span>
        <span class="tok-n">additional_window</span><span class="tok-o">.</span><span class="tok-n">remember_is_visible</span> <span class="tok-o">=</span> <span class="tok-kc">False</span>  <span class="tok-c1"># its visibility is not saved in the settings file,</span>
        <span class="tok-n">additional_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MiscSpace&quot;</span>  <span class="tok-c1"># when shown, it will appear in MiscSpace.</span>
        <span class="tok-n">additional_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;This is the additional window&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">add_dockable_window</span><span class="tok-p">(</span>
            <span class="tok-n">additional_window</span><span class="tok-p">,</span>
            <span class="tok-n">force_dockspace</span><span class="tok-o">=</span><span class="tok-kc">False</span>  <span class="tok-c1"># means that the window will be docked to the last space it was docked to</span>
                                   <span class="tok-c1"># i.e. dock_space_name is ignored if the user previously moved the window to another space</span>
        <span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_item_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;By clicking this button, you can show an additional window&quot;</span><span class="tok-p">)</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Remove additional window&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">remove_dockable_window</span><span class="tok-p">(</span><span class="tok-n">window_name</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_item_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;By clicking this button, you can remove the additional window&quot;</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_basic_widgets</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Basic widgets demo&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin_group</span><span class="tok-p">()</span>
    <span class="tok-c1"># Edit a float using a slider from 0.0 to 1.0</span>
    <span class="tok-n">changed</span><span class="tok-p">,</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">f</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">slider_float</span><span class="tok-p">(</span><span class="tok-s2">&quot;float&quot;</span><span class="tok-p">,</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">f</span><span class="tok-p">,</span> <span class="tok-mf">0.0</span><span class="tok-p">,</span> <span class="tok-mf">1.0</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">changed</span><span class="tok-p">:</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span>
            <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">warning</span><span class="tok-p">,</span> <span class="tok-sa">f</span><span class="tok-s2">&quot;state.f was changed to </span><span class="tok-si">{</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">f</span><span class="tok-si">}</span><span class="tok-s2">&quot;</span>
        <span class="tok-p">)</span>

    <span class="tok-c1"># Buttons return true when clicked (most widgets return true when edited/activated)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Button&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">counter</span> <span class="tok-o">+=</span> <span class="tok-mi">1</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Button was pressed&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-sa">f</span><span class="tok-s2">&quot;counter = </span><span class="tok-si">{</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">counter</span><span class="tok-si">}</span><span class="tok-s2">&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end_group</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;These widgets will interact with the log window&quot;</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_user_settings</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;User settings&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin_group</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_next_item_width</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">(</span><span class="tok-mf">7.0</span><span class="tok-p">))</span>
    <span class="tok-n">_</span><span class="tok-p">,</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">my_app_settings</span><span class="tok-o">.</span><span class="tok-n">value</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">slider_int</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;Value&quot;</span><span class="tok-p">,</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">my_app_settings</span><span class="tok-o">.</span><span class="tok-n">value</span><span class="tok-p">,</span> <span class="tok-mi">0</span><span class="tok-p">,</span> <span class="tok-mi">100</span>
    <span class="tok-p">)</span>

    <span class="tok-n">_</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">input_text_resizable</span><span class="tok-p">(</span><span class="tok-s2">&quot;Motto&quot;</span><span class="tok-p">,</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">my_app_settings</span><span class="tok-o">.</span><span class="tok-n">motto</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;(this text widget is resizable)&quot;</span><span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end_group</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;The values below are stored in the application settings ini file and restored at startup&quot;</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_rocket</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Rocket demo&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin_group</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_state</span> <span class="tok-o">==</span> <span class="tok-n">RocketState</span><span class="tok-o">.</span><span class="tok-n">Init</span><span class="tok-p">:</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-sa">f</span><span class="tok-s2">&quot;</span><span class="tok-si">{</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_ROCKET</span><span class="tok-si">}</span><span class="tok-s2"> Launch rocket&quot;</span><span class="tok-p">):</span>
            <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_launch_time</span> <span class="tok-o">=</span> <span class="tok-n">time</span><span class="tok-o">.</span><span class="tok-n">time</span><span class="tok-p">()</span>
            <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_state</span> <span class="tok-o">=</span> <span class="tok-n">RocketState</span><span class="tok-o">.</span><span class="tok-n">Preparing</span>
            <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">warning</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Rocket is being prepared&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">elif</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_state</span> <span class="tok-o">==</span> <span class="tok-n">RocketState</span><span class="tok-o">.</span><span class="tok-n">Preparing</span><span class="tok-p">:</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Please Wait&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_progress</span> <span class="tok-o">=</span> <span class="tok-p">(</span><span class="tok-n">time</span><span class="tok-o">.</span><span class="tok-n">time</span><span class="tok-p">()</span> <span class="tok-o">-</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_launch_time</span><span class="tok-p">)</span> <span class="tok-o">/</span> <span class="tok-mf">3.0</span>
        <span class="tok-k">if</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_progress</span> <span class="tok-o">&gt;=</span> <span class="tok-mf">1.0</span><span class="tok-p">:</span>
            <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_state</span> <span class="tok-o">=</span> <span class="tok-n">RocketState</span><span class="tok-o">.</span><span class="tok-n">Launched</span>
            <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">warning</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Rocket was launched&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">elif</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_state</span> <span class="tok-o">==</span> <span class="tok-n">RocketState</span><span class="tok-o">.</span><span class="tok-n">Launched</span><span class="tok-p">:</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-sa">f</span><span class="tok-s2">&quot;</span><span class="tok-si">{</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_ROCKET</span><span class="tok-si">}</span><span class="tok-s2"> Rocket launched&quot;</span><span class="tok-p">)</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Reset Rocket&quot;</span><span class="tok-p">):</span>
            <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_state</span> <span class="tok-o">=</span> <span class="tok-n">RocketState</span><span class="tok-o">.</span><span class="tok-n">Init</span>
            <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_progress</span> <span class="tok-o">=</span> <span class="tok-mf">0.0</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end_group</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;Look at the status bar after clicking&quot;</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_docking_flags</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Main dock space node flags&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text_wrapped</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">This will edit the ImGuiDockNodeFlags for &quot;MainDockSpace&quot;.</span>
<span class="tok-sd">Most flags are inherited by children dock spaces.</span>
<span class="tok-sd">        &quot;&quot;&quot;</span>
    <span class="tok-p">)</span>

    <span class="tok-k">class</span> <span class="tok-nc">DockFlagWithInfo</span><span class="tok-p">:</span>
        <span class="tok-k">def</span> <span class="tok-fm">__init__</span><span class="tok-p">(</span><span class="tok-bp">self</span><span class="tok-p">,</span> <span class="tok-n">flag</span><span class="tok-p">,</span> <span class="tok-n">label</span><span class="tok-p">,</span> <span class="tok-n">tip</span><span class="tok-p">):</span>
            <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">flag</span> <span class="tok-o">=</span> <span class="tok-n">flag</span>
            <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-n">label</span>
            <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">tip</span> <span class="tok-o">=</span> <span class="tok-n">tip</span>

    <span class="tok-n">all_flags</span> <span class="tok-o">=</span> <span class="tok-p">[</span>
        <span class="tok-n">DockFlagWithInfo</span><span class="tok-p">(</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">DockNodeFlags_</span><span class="tok-o">.</span><span class="tok-n">no_docking_split</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;NoSplit&quot;</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;prevent Dock Nodes from being split&quot;</span><span class="tok-p">,</span>
        <span class="tok-p">),</span>
        <span class="tok-n">DockFlagWithInfo</span><span class="tok-p">(</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">DockNodeFlags_</span><span class="tok-o">.</span><span class="tok-n">no_resize</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;NoResize&quot;</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;prevent Dock Nodes from being resized&quot;</span><span class="tok-p">,</span>
        <span class="tok-p">),</span>
        <span class="tok-n">DockFlagWithInfo</span><span class="tok-p">(</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">DockNodeFlags_</span><span class="tok-o">.</span><span class="tok-n">auto_hide_tab_bar</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;AutoHideTabBar&quot;</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;show tab bar only if multiple windows</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span>
            <span class="tok-o">+</span> <span class="tok-s1">&#39;You will need to restore the layout after changing (Menu &quot;View/Restore Layout&quot;)&#39;</span><span class="tok-p">,</span>
        <span class="tok-p">),</span>
        <span class="tok-n">DockFlagWithInfo</span><span class="tok-p">(</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">DockNodeFlags_</span><span class="tok-o">.</span><span class="tok-n">no_docking_over_central_node</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;NoDockingInCentralNode&quot;</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;prevent docking in central node</span><span class="tok-se">\n</span><span class="tok-s2">(only works with the main dock space)&quot;</span><span class="tok-p">,</span>
        <span class="tok-p">),</span>
        <span class="tok-c1"># DockFlagWithInfo(imgui.DockNodeFlags_.passthru_central_node, &quot;PassthruCentralNode&quot;, &quot;advanced&quot;),</span>
    <span class="tok-p">]</span>

    <span class="tok-n">main_dock_space_node_flags</span> <span class="tok-o">=</span> <span class="tok-p">(</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_runner_params</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">docking_params</span><span class="tok-o">.</span><span class="tok-n">main_dock_space_node_flags</span>
    <span class="tok-p">)</span>
    <span class="tok-k">for</span> <span class="tok-n">flag_with_info</span> <span class="tok-ow">in</span> <span class="tok-n">all_flags</span><span class="tok-p">:</span>
        <span class="tok-n">_</span><span class="tok-p">,</span> <span class="tok-n">main_dock_space_node_flags</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">checkbox_flags</span><span class="tok-p">(</span>
            <span class="tok-n">flag_with_info</span><span class="tok-o">.</span><span class="tok-n">label</span><span class="tok-p">,</span> <span class="tok-n">main_dock_space_node_flags</span><span class="tok-p">,</span> <span class="tok-n">flag_with_info</span><span class="tok-o">.</span><span class="tok-n">flag</span>
        <span class="tok-p">)</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;</span><span class="tok-si">%s</span><span class="tok-s2">&quot;</span> <span class="tok-o">%</span> <span class="tok-n">flag_with_info</span><span class="tok-o">.</span><span class="tok-n">tip</span><span class="tok-p">)</span>

    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_runner_params</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">docking_params</span><span class="tok-o">.</span><span class="tok-n">main_dock_space_node_flags</span> <span class="tok-o">=</span> <span class="tok-p">(</span>
        <span class="tok-n">main_dock_space_node_flags</span>
    <span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">gui_window_layout_customization</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Switch between layouts&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s1">&#39;with the menu &quot;View/Layouts&quot;&#39;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span>
            <span class="tok-s2">&quot;Each layout remembers separately the modifications applied by the user, </span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span>
            <span class="tok-o">+</span> <span class="tok-s2">&quot;and the selected layout is restored at startup&quot;</span>
        <span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>

    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Change the theme&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s1">&#39;with the menu &quot;View/Theme&quot;&#39;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;The selected theme is remembered and restored at startup&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>

    <span class="tok-n">demo_docking_flags</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>


<span class="tok-k">def</span> <span class="tok-nf">gui_window_alternative_theme</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-c1"># Since this window applies a theme, We need to call &quot;imgui.begin&quot; ourselves so</span>
    <span class="tok-c1"># that we can apply the theme before opening the window.</span>
    <span class="tok-c1">#</span>
    <span class="tok-c1"># In order to obtain this, we applied the following option to the window</span>
    <span class="tok-c1"># that displays this Gui:</span>
    <span class="tok-c1">#     alternative_theme_window.call_begin_end = False</span>

    <span class="tok-c1"># emulate C/C++ static variable: we will store some static variables</span>
    <span class="tok-c1"># as attributes of the function</span>
    <span class="tok-n">statics</span> <span class="tok-o">=</span> <span class="tok-n">gui_window_alternative_theme</span>

    <span class="tok-c1"># Apply the theme before opening the window</span>
    <span class="tok-n">tweaked_theme</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">ImGuiTweakedTheme</span><span class="tok-p">()</span>
    <span class="tok-n">tweaked_theme</span><span class="tok-o">.</span><span class="tok-n">theme</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">ImGuiTheme_</span><span class="tok-o">.</span><span class="tok-n">white_is_white</span>
    <span class="tok-n">tweaked_theme</span><span class="tok-o">.</span><span class="tok-n">tweaks</span><span class="tok-o">.</span><span class="tok-n">rounding</span> <span class="tok-o">=</span> <span class="tok-mf">0.0</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">push_tweaked_theme</span><span class="tok-p">(</span><span class="tok-n">tweaked_theme</span><span class="tok-p">)</span>

    <span class="tok-c1"># Open the window</span>
    <span class="tok-n">window_opened</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin</span><span class="tok-p">(</span><span class="tok-s2">&quot;Alternative Theme&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">window_opened</span><span class="tok-p">:</span>
        <span class="tok-c1"># Display some widgets</span>
        <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Alternative Theme&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;This window uses a different theme&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_item_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;&quot;&quot;</span>
<span class="tok-s2">            tweaked_theme = hello_imgui.ImGuiTheme.ImGuiTweakedTheme()</span>
<span class="tok-s2">            tweaked_theme.theme = hello_imgui.ImGuiTheme_.white_is_white</span>
<span class="tok-s2">            tweaked_theme.tweaks.rounding = 0.0</span>
<span class="tok-s2">            hello_imgui.apply_tweaked_theme(tweaked_theme)</span>
<span class="tok-s2">        &quot;&quot;&quot;</span>
        <span class="tok-p">)</span>

        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">collapsing_header</span><span class="tok-p">(</span><span class="tok-s2">&quot;Basic Widgets&quot;</span><span class="tok-p">,</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">TreeNodeFlags_</span><span class="tok-o">.</span><span class="tok-n">default_open</span><span class="tok-p">):</span>
            <span class="tok-k">if</span> <span class="tok-ow">not</span> <span class="tok-nb">hasattr</span><span class="tok-p">(</span><span class="tok-n">statics</span><span class="tok-p">,</span> <span class="tok-s2">&quot;checked&quot;</span><span class="tok-p">):</span>
                <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">checked</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
            <span class="tok-n">_</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">checked</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">checkbox</span><span class="tok-p">(</span><span class="tok-s2">&quot;Checkbox&quot;</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">checked</span><span class="tok-p">)</span>

            <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Button&quot;</span><span class="tok-p">):</span>
                <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Button was pressed&quot;</span><span class="tok-p">)</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_item_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;This is a button&quot;</span><span class="tok-p">)</span>

            <span class="tok-k">if</span> <span class="tok-ow">not</span> <span class="tok-nb">hasattr</span><span class="tok-p">(</span><span class="tok-n">statics</span><span class="tok-p">,</span> <span class="tok-s2">&quot;radio&quot;</span><span class="tok-p">):</span>
                <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">radio</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>
            <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">radio_button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Radio 1&quot;</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">radio</span> <span class="tok-o">==</span> <span class="tok-mi">0</span><span class="tok-p">):</span>
                <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">radio</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
            <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">radio_button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Radio 2&quot;</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">radio</span> <span class="tok-o">==</span> <span class="tok-mi">1</span><span class="tok-p">):</span>
                <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">radio</span> <span class="tok-o">=</span> <span class="tok-mi">1</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
            <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">radio_button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Radio 3&quot;</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">radio</span> <span class="tok-o">==</span> <span class="tok-mi">2</span><span class="tok-p">):</span>
                <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">radio</span> <span class="tok-o">=</span> <span class="tok-mi">2</span>

            <span class="tok-c1"># Haiku</span>
            <span class="tok-c1"># Display a image of the haiku below with Japanese characters</span>
            <span class="tok-c1"># with an informative tooltip</span>
            <span class="tok-n">haiku_image_height</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">(</span><span class="tok-mf">5.0</span><span class="tok-p">)</span>
            <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">image_from_asset</span><span class="tok-p">(</span><span class="tok-s2">&quot;images/haiku.png&quot;</span><span class="tok-p">,</span> <span class="tok-p">(</span><span class="tok-mf">0.0</span><span class="tok-p">,</span> <span class="tok-n">haiku_image_height</span><span class="tok-p">))</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_item_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;&quot;&quot;</span>
<span class="tok-s2">Extract from Wikipedia</span>
<span class="tok-s2">-------------------------------------------------------------------------------</span>

<span class="tok-s2">In early 1686, Bashō composed one of his best-remembered haiku:</span>

<span class="tok-s2">        furu ike ya / kawazu tobikomu / mizu no oto</span>

<span class="tok-s2">   an ancient pond / a frog jumps in / the splash of water</span>

<span class="tok-s2">This poem became instantly famous.</span>

<span class="tok-s2">-------------------------------------------------------------------------------</span>

<span class="tok-s2">This haiku is here rendered as an image, mainly to preserve space,</span>
<span class="tok-s2">because adding a Japanese font to the project would enlarge its size.</span>
<span class="tok-s2">Handling Japanese font is of course possible within ImGui / Hello ImGui!</span>
<span class="tok-s2">            &quot;&quot;&quot;</span><span class="tok-p">)</span>

            <span class="tok-c1"># Display the haiku text as an InputTextMultiline</span>
            <span class="tok-k">if</span> <span class="tok-ow">not</span> <span class="tok-nb">hasattr</span><span class="tok-p">(</span><span class="tok-n">statics</span><span class="tok-p">,</span> <span class="tok-s2">&quot;poem&quot;</span><span class="tok-p">):</span>
                <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">poem</span> <span class="tok-o">=</span> <span class="tok-p">(</span>
                    <span class="tok-s2">&quot;   Old Pond</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span>
                    <span class="tok-s2">&quot;  Frog Leaps In</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span>
                    <span class="tok-s2">&quot; Water&#39;s Sound</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span>
                    <span class="tok-s2">&quot;</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span>
                    <span class="tok-s2">&quot;      Matsuo Bashō - 1686&quot;</span>
                <span class="tok-p">)</span>

            <span class="tok-n">_</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">poem</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">input_text_multiline</span><span class="tok-p">(</span><span class="tok-s2">&quot;##Poem&quot;</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">poem</span><span class="tok-p">,</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_to_vec2</span><span class="tok-p">(</span><span class="tok-mf">15.0</span><span class="tok-p">,</span> <span class="tok-mf">5.5</span><span class="tok-p">))</span>

            <span class="tok-c1"># a popup with a modal window</span>
            <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Open Modal&quot;</span><span class="tok-p">):</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">open_popup</span><span class="tok-p">(</span><span class="tok-s2">&quot;MyModal&quot;</span><span class="tok-p">)</span>
            <span class="tok-n">popup_opened</span><span class="tok-p">,</span> <span class="tok-n">_</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin_popup_modal</span><span class="tok-p">(</span><span class="tok-s2">&quot;MyModal&quot;</span><span class="tok-p">,</span> <span class="tok-kc">None</span><span class="tok-p">,</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">WindowFlags_</span><span class="tok-o">.</span><span class="tok-n">always_auto_resize</span><span class="tok-p">)</span>
            <span class="tok-k">if</span> <span class="tok-n">popup_opened</span><span class="tok-p">:</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;This is a modal window&quot;</span><span class="tok-p">)</span>
                <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Close&quot;</span><span class="tok-p">):</span>
                    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">close_current_popup</span><span class="tok-p">()</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end_popup</span><span class="tok-p">()</span>

            <span class="tok-k">if</span> <span class="tok-ow">not</span> <span class="tok-nb">hasattr</span><span class="tok-p">(</span><span class="tok-n">statics</span><span class="tok-p">,</span> <span class="tok-s2">&quot;text&quot;</span><span class="tok-p">):</span>
                <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">text</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Hello, world!&quot;</span>
            <span class="tok-n">_</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">text</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">input_text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Input text&quot;</span><span class="tok-p">,</span> <span class="tok-n">statics</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">)</span>

            <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">tree_node</span><span class="tok-p">(</span><span class="tok-s2">&quot;Text Display&quot;</span><span class="tok-p">):</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Hello, world!&quot;</span><span class="tok-p">)</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text_colored</span><span class="tok-p">((</span><span class="tok-mf">1.0</span><span class="tok-p">,</span> <span class="tok-mf">0.5</span><span class="tok-p">,</span> <span class="tok-mf">0.5</span><span class="tok-p">,</span> <span class="tok-mf">1.0</span><span class="tok-p">),</span> <span class="tok-s2">&quot;Some text&quot;</span><span class="tok-p">)</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text_disabled</span><span class="tok-p">(</span><span class="tok-s2">&quot;Disabled text&quot;</span><span class="tok-p">)</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text_wrapped</span><span class="tok-p">(</span><span class="tok-s2">&quot;This is a long text that will be wrapped in the window&quot;</span><span class="tok-p">)</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">tree_pop</span><span class="tok-p">()</span>

    <span class="tok-c1"># Close the window</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end</span><span class="tok-p">()</span>

    <span class="tok-c1"># Restore the theme</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">pop_tweaked_theme</span><span class="tok-p">()</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_assets</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Image From Assets&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">begin_group_column</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">dummy</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_to_vec2</span><span class="tok-p">(</span><span class="tok-mf">0.0</span><span class="tok-p">,</span> <span class="tok-mf">0.45</span><span class="tok-p">))</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Hello&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">end_group_column</span><span class="tok-p">()</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">image_from_asset</span><span class="tok-p">(</span><span class="tok-s2">&quot;images/world.png&quot;</span><span class="tok-p">,</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_to_vec2</span><span class="tok-p">(</span><span class="tok-mf">2.5</span><span class="tok-p">,</span> <span class="tok-mf">2.5</span><span class="tok-p">))</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_fonts</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Fonts - &quot;</span> <span class="tok-o">+</span> <span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_ROCKET</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text_wrapped</span><span class="tok-p">(</span><span class="tok-s2">&quot;Mix icons &quot;</span> <span class="tok-o">+</span> <span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_FACE_SMILE</span> <span class="tok-o">+</span> <span class="tok-s2">&quot; and text &quot;</span> <span class="tok-o">+</span> <span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_ROCKET</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;Example with Font Awesome Icons&quot;</span><span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Emojis&quot;</span><span class="tok-p">)</span>

    <span class="tok-k">with</span> <span class="tok-n">imgui_ctx</span><span class="tok-o">.</span><span class="tok-n">begin_group</span><span class="tok-p">():</span>
        <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">emoji_font</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;✌❤🌴🚀&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;Example with NotoEmoji font&quot;</span><span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Colored Fonts&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">color_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;COLOR!&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;Example with Playbox-FREE.otf font&quot;</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_themes</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">title_font</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Themes&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>

    <span class="tok-n">tweaked_theme</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_runner_params</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">tweaked_theme</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin_group</span><span class="tok-p">()</span>
    <span class="tok-n">button_size</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_to_vec2</span><span class="tok-p">(</span><span class="tok-mf">7.0</span><span class="tok-p">,</span> <span class="tok-mf">0.0</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Cherry&quot;</span><span class="tok-p">,</span> <span class="tok-n">button_size</span><span class="tok-p">):</span>
        <span class="tok-n">tweaked_theme</span><span class="tok-o">.</span><span class="tok-n">theme</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">ImGuiTheme_</span><span class="tok-o">.</span><span class="tok-n">cherry</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">apply_tweaked_theme</span><span class="tok-p">(</span><span class="tok-n">tweaked_theme</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;DarculaDarker&quot;</span><span class="tok-p">,</span> <span class="tok-n">button_size</span><span class="tok-p">):</span>
        <span class="tok-n">tweaked_theme</span><span class="tok-o">.</span><span class="tok-n">theme</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">ImGuiTheme_</span><span class="tok-o">.</span><span class="tok-n">darcula_darker</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">apply_tweaked_theme</span><span class="tok-p">(</span><span class="tok-n">tweaked_theme</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end_group</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span>
            <span class="tok-s2">&quot;There are lots of other themes: look at the menu View/Theme</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span>
            <span class="tok-s2">&quot;The selected theme is remembered and restored at startup&quot;</span>
        <span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">gui_window_demo_features</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">demo_fonts</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>
    <span class="tok-n">demo_assets</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>
    <span class="tok-n">demo_basic_widgets</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>
    <span class="tok-n">demo_rocket</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>
    <span class="tok-n">demo_user_settings</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>
    <span class="tok-n">demo_hide_window</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>
    <span class="tok-n">demo_show_additional_window</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>
    <span class="tok-n">demo_themes</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>


<span class="tok-k">def</span> <span class="tok-nf">status_bar_gui</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-k">if</span> <span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_state</span> <span class="tok-o">==</span> <span class="tok-n">RocketState</span><span class="tok-o">.</span><span class="tok-n">Preparing</span><span class="tok-p">:</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Rocket completion: &quot;</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">progress_bar</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">rocket_progress</span><span class="tok-p">,</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_to_vec2</span><span class="tok-p">(</span><span class="tok-mf">7.0</span><span class="tok-p">,</span> <span class="tok-mf">1.0</span><span class="tok-p">))</span>  <span class="tok-c1"># type: ignore</span>


<span class="tok-k">def</span> <span class="tok-nf">show_menu_gui</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">:</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">RunnerParams</span><span class="tok-p">):</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">show_app_menu</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">)</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">show_view_menu</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin_menu</span><span class="tok-p">(</span><span class="tok-s2">&quot;My Menu&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">clicked</span><span class="tok-p">,</span> <span class="tok-n">_</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">menu_item</span><span class="tok-p">(</span><span class="tok-s2">&quot;Test me&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;&quot;</span><span class="tok-p">,</span> <span class="tok-kc">False</span><span class="tok-p">)</span>
        <span class="tok-k">if</span> <span class="tok-n">clicked</span><span class="tok-p">:</span>
            <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">warning</span><span class="tok-p">,</span> <span class="tok-s2">&quot;It works&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end_menu</span><span class="tok-p">()</span>


<span class="tok-k">def</span> <span class="tok-nf">show_app_menu_items</span><span class="tok-p">():</span>
    <span class="tok-n">clicked</span><span class="tok-p">,</span> <span class="tok-n">_</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">menu_item</span><span class="tok-p">(</span><span class="tok-s2">&quot;A Custom app menu item&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;&quot;</span><span class="tok-p">,</span> <span class="tok-kc">False</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">clicked</span><span class="tok-p">:</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Clicked on A Custom app menu item&quot;</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">show_top_toolbar</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">large_icon_font</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_POWER_OFF</span><span class="tok-p">):</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_runner_params</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">app_shall_exit</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_window_width</span><span class="tok-p">()</span> <span class="tok-o">-</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">(</span><span class="tok-mf">7.0</span><span class="tok-p">))</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_HOUSE</span><span class="tok-p">):</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Clicked on Home in the top toolbar&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_FLOPPY_DISK</span><span class="tok-p">):</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Clicked on Save in the top toolbar&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_ADDRESS_BOOK</span><span class="tok-p">):</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Clicked on Address Book in the top toolbar&quot;</span><span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_window_width</span><span class="tok-p">()</span> <span class="tok-o">-</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">(</span><span class="tok-mf">2.0</span><span class="tok-p">))</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_BATTERY_THREE_QUARTERS</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>


<span class="tok-k">def</span> <span class="tok-nf">show_right_toolbar</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">):</span>
    <span class="tok-n">push_font_with_default_size</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">large_icon_font</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_CIRCLE_ARROW_LEFT</span><span class="tok-p">):</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Clicked on Circle left in the right toolbar&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-n">icons_fontawesome_6</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_CIRCLE_ARROW_RIGHT</span><span class="tok-p">):</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Clicked on Circle right in the right toolbar&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>


<span class="tok-c1">##########################################################################</span>
<span class="tok-c1">#    Docking Layouts and Docking windows</span>
<span class="tok-c1">##########################################################################</span>

<span class="tok-c1">#</span>
<span class="tok-c1"># 1. Define the Docking splits (two versions are available)</span>
<span class="tok-c1">#</span>
<span class="tok-k">def</span> <span class="tok-nf">create_default_docking_splits</span><span class="tok-p">()</span> <span class="tok-o">-&gt;</span> <span class="tok-n">List</span><span class="tok-p">[</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">]:</span>
    <span class="tok-c1"># Define the default docking splits,</span>
    <span class="tok-c1"># i.e. the way the screen space is split in different target zones for the dockable windows</span>
    <span class="tok-c1"># We want to split &quot;MainDockSpace&quot; (which is provided automatically) into three zones, like this:</span>
    <span class="tok-c1">#</span>
    <span class="tok-c1">#    ___________________________________________</span>
    <span class="tok-c1">#    |        |                                |</span>
    <span class="tok-c1">#    | Command|                                |</span>
    <span class="tok-c1">#    | Space  |    MainDockSpace               |</span>
    <span class="tok-c1">#    |------- |                                |</span>
    <span class="tok-c1">#    |        |--------------------------------|</span>
    <span class="tok-c1">#    |        |       CommandSpace2            |</span>
    <span class="tok-c1">#    -------------------------------------------</span>
    <span class="tok-c1">#    |     MiscSpace                           |</span>
    <span class="tok-c1">#    -------------------------------------------</span>
    <span class="tok-c1">#</span>

    <span class="tok-c1"># Uncomment the next line if you want to always start with this layout.</span>
    <span class="tok-c1"># Otherwise, modifications to the layout applied by the user layout will be remembered.</span>
    <span class="tok-c1"># runner_params.docking_params.layout_condition = hello_imgui.DockingLayoutCondition.ApplicationStart</span>

    <span class="tok-c1"># Then, add a space named &quot;MiscSpace&quot; whose height is 25% of the app height.</span>
    <span class="tok-c1"># This will split the preexisting default dockspace &quot;MainDockSpace&quot; in two parts.</span>
    <span class="tok-n">split_main_misc</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">()</span>
    <span class="tok-n">split_main_misc</span><span class="tok-o">.</span><span class="tok-n">initial_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">split_main_misc</span><span class="tok-o">.</span><span class="tok-n">new_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MiscSpace&quot;</span>
    <span class="tok-n">split_main_misc</span><span class="tok-o">.</span><span class="tok-n">direction</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Dir</span><span class="tok-o">.</span><span class="tok-n">down</span>
    <span class="tok-n">split_main_misc</span><span class="tok-o">.</span><span class="tok-n">ratio</span> <span class="tok-o">=</span> <span class="tok-mf">0.25</span>

    <span class="tok-c1"># Then, add a space to the left which occupies a column whose width is 25% of the app width</span>
    <span class="tok-n">split_main_command</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">()</span>
    <span class="tok-n">split_main_command</span><span class="tok-o">.</span><span class="tok-n">initial_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">split_main_command</span><span class="tok-o">.</span><span class="tok-n">new_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;CommandSpace&quot;</span>
    <span class="tok-n">split_main_command</span><span class="tok-o">.</span><span class="tok-n">direction</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Dir</span><span class="tok-o">.</span><span class="tok-n">left</span>
    <span class="tok-n">split_main_command</span><span class="tok-o">.</span><span class="tok-n">ratio</span> <span class="tok-o">=</span> <span class="tok-mf">0.25</span>

    <span class="tok-c1"># Then, add CommandSpace2 below MainDockSpace</span>
    <span class="tok-n">split_main_command2</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">()</span>
    <span class="tok-n">split_main_command2</span><span class="tok-o">.</span><span class="tok-n">initial_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">split_main_command2</span><span class="tok-o">.</span><span class="tok-n">new_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;CommandSpace2&quot;</span>
    <span class="tok-n">split_main_command2</span><span class="tok-o">.</span><span class="tok-n">direction</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Dir</span><span class="tok-o">.</span><span class="tok-n">down</span>
    <span class="tok-n">split_main_command2</span><span class="tok-o">.</span><span class="tok-n">ratio</span> <span class="tok-o">=</span> <span class="tok-mf">0.5</span>

    <span class="tok-n">splits</span> <span class="tok-o">=</span> <span class="tok-p">[</span><span class="tok-n">split_main_misc</span><span class="tok-p">,</span> <span class="tok-n">split_main_command</span><span class="tok-p">,</span> <span class="tok-n">split_main_command2</span><span class="tok-p">]</span>
    <span class="tok-k">return</span> <span class="tok-n">splits</span>


<span class="tok-k">def</span> <span class="tok-nf">create_alternative_docking_splits</span><span class="tok-p">()</span> <span class="tok-o">-&gt;</span> <span class="tok-n">List</span><span class="tok-p">[</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">]:</span>
    <span class="tok-c1"># Define alternative docking splits for the &quot;Alternative Layout&quot;</span>
    <span class="tok-c1">#    ___________________________________________</span>
    <span class="tok-c1">#    |                |                        |</span>
    <span class="tok-c1">#    | Misc           |                        |</span>
    <span class="tok-c1">#    | Space          |    MainDockSpace       |</span>
    <span class="tok-c1">#    |                |                        |</span>
    <span class="tok-c1">#    -------------------------------------------</span>
    <span class="tok-c1">#    |                       |                 |</span>
    <span class="tok-c1">#    |                       | Command         |</span>
    <span class="tok-c1">#    |     CommandSpace      | Space2          |</span>
    <span class="tok-c1">#    -------------------------------------------</span>

    <span class="tok-n">split_main_command</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">()</span>
    <span class="tok-n">split_main_command</span><span class="tok-o">.</span><span class="tok-n">initial_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">split_main_command</span><span class="tok-o">.</span><span class="tok-n">new_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;CommandSpace&quot;</span>
    <span class="tok-n">split_main_command</span><span class="tok-o">.</span><span class="tok-n">direction</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Dir</span><span class="tok-o">.</span><span class="tok-n">down</span>
    <span class="tok-n">split_main_command</span><span class="tok-o">.</span><span class="tok-n">ratio</span> <span class="tok-o">=</span> <span class="tok-mf">0.5</span>

    <span class="tok-n">split_main_command2</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">()</span>
    <span class="tok-n">split_main_command2</span><span class="tok-o">.</span><span class="tok-n">initial_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;CommandSpace&quot;</span>
    <span class="tok-n">split_main_command2</span><span class="tok-o">.</span><span class="tok-n">new_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;CommandSpace2&quot;</span>
    <span class="tok-n">split_main_command2</span><span class="tok-o">.</span><span class="tok-n">direction</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Dir</span><span class="tok-o">.</span><span class="tok-n">right</span>
    <span class="tok-n">split_main_command2</span><span class="tok-o">.</span><span class="tok-n">ratio</span> <span class="tok-o">=</span> <span class="tok-mf">0.4</span>

    <span class="tok-n">split_main_misc</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">()</span>
    <span class="tok-n">split_main_misc</span><span class="tok-o">.</span><span class="tok-n">initial_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">split_main_misc</span><span class="tok-o">.</span><span class="tok-n">new_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MiscSpace&quot;</span>
    <span class="tok-n">split_main_misc</span><span class="tok-o">.</span><span class="tok-n">direction</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Dir</span><span class="tok-o">.</span><span class="tok-n">left</span>
    <span class="tok-n">split_main_misc</span><span class="tok-o">.</span><span class="tok-n">ratio</span> <span class="tok-o">=</span> <span class="tok-mf">0.5</span>

    <span class="tok-n">splits</span> <span class="tok-o">=</span> <span class="tok-p">[</span><span class="tok-n">split_main_command</span><span class="tok-p">,</span> <span class="tok-n">split_main_command2</span><span class="tok-p">,</span> <span class="tok-n">split_main_misc</span><span class="tok-p">]</span>
    <span class="tok-k">return</span> <span class="tok-n">splits</span>


<span class="tok-c1">#</span>
<span class="tok-c1"># 2. Define the Dockable windows</span>
<span class="tok-c1">#</span>
<span class="tok-k">def</span> <span class="tok-nf">create_dockable_windows</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-n">List</span><span class="tok-p">[</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">]:</span>
    <span class="tok-c1"># A features demo window named &quot;FeaturesDemo&quot; will be placed in &quot;CommandSpace&quot;.</span>
    <span class="tok-c1"># Its Gui is provided by &quot;gui_window_demo_features&quot;</span>
    <span class="tok-n">features_demo_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
    <span class="tok-n">features_demo_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Features Demo&quot;</span>
    <span class="tok-n">features_demo_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;CommandSpace&quot;</span>
    <span class="tok-n">features_demo_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">gui_window_demo_features</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>

    <span class="tok-c1"># A layout customization window will be placed in &quot;MainDockSpace&quot;.</span>
    <span class="tok-c1"># Its Gui is provided by &quot;gui_window_layout_customization&quot;</span>
    <span class="tok-n">layout_customization_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
    <span class="tok-n">layout_customization_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Layout customization&quot;</span>
    <span class="tok-n">layout_customization_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">layout_customization_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">gui_window_layout_customization</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>

    <span class="tok-c1"># A Log window named &quot;Logs&quot; will be placed in &quot;MiscSpace&quot;. It uses the HelloImGui logger gui</span>
    <span class="tok-n">logs_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
    <span class="tok-n">logs_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Logs&quot;</span>
    <span class="tok-n">logs_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MiscSpace&quot;</span>
    <span class="tok-n">logs_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log_gui</span>

    <span class="tok-c1"># A Window named &quot;Dear ImGui Demo&quot; will be placed in &quot;MainDockSpace&quot;</span>
    <span class="tok-n">dear_imgui_demo_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
    <span class="tok-n">dear_imgui_demo_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Dear ImGui Demo&quot;</span>
    <span class="tok-n">dear_imgui_demo_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">dear_imgui_demo_window</span><span class="tok-o">.</span><span class="tok-n">imgui_window_flags</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">WindowFlags_</span><span class="tok-o">.</span><span class="tok-n">menu_bar</span>
    <span class="tok-n">dear_imgui_demo_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">show_demo_window</span>  <span class="tok-c1"># type: ignore</span>

    <span class="tok-c1"># alternativeThemeWindow</span>
    <span class="tok-n">alternative_theme_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
    <span class="tok-c1"># Since this window applies a theme, We need to call &quot;imgui.begin&quot; ourselves so</span>
    <span class="tok-c1"># that we can apply the theme before opening the window.</span>
    <span class="tok-n">alternative_theme_window</span><span class="tok-o">.</span><span class="tok-n">call_begin_end</span> <span class="tok-o">=</span> <span class="tok-kc">False</span>
    <span class="tok-n">alternative_theme_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Alternative Theme&quot;</span>
    <span class="tok-n">alternative_theme_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;CommandSpace2&quot;</span>
    <span class="tok-n">alternative_theme_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">gui_window_alternative_theme</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>

    <span class="tok-n">dockable_windows</span> <span class="tok-o">=</span> <span class="tok-p">[</span>
        <span class="tok-n">features_demo_window</span><span class="tok-p">,</span>
        <span class="tok-n">layout_customization_window</span><span class="tok-p">,</span>
        <span class="tok-n">logs_window</span><span class="tok-p">,</span>
        <span class="tok-n">dear_imgui_demo_window</span><span class="tok-p">,</span>
        <span class="tok-n">alternative_theme_window</span><span class="tok-p">,</span>
    <span class="tok-p">]</span>
    <span class="tok-k">return</span> <span class="tok-n">dockable_windows</span>


<span class="tok-c1">#</span>
<span class="tok-c1"># 3. Define the layouts:</span>
<span class="tok-c1"># A layout is stored inside DockingParams, and stores the splits + the dockable windows.</span>
<span class="tok-c1"># Here, we provide the default layout, and two alternative layouts.</span>
<span class="tok-k">def</span> <span class="tok-nf">create_default_layout</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingParams</span><span class="tok-p">:</span>
    <span class="tok-n">docking_params</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingParams</span><span class="tok-p">()</span>
    <span class="tok-c1"># By default, the layout name is already &quot;Default&quot;</span>
    <span class="tok-c1"># docking_params.layout_name = &quot;Default&quot;</span>
    <span class="tok-n">docking_params</span><span class="tok-o">.</span><span class="tok-n">docking_splits</span> <span class="tok-o">=</span> <span class="tok-n">create_default_docking_splits</span><span class="tok-p">()</span>
    <span class="tok-n">docking_params</span><span class="tok-o">.</span><span class="tok-n">dockable_windows</span> <span class="tok-o">=</span> <span class="tok-n">create_dockable_windows</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-k">return</span> <span class="tok-n">docking_params</span>


<span class="tok-k">def</span> <span class="tok-nf">create_alternative_layouts</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">:</span> <span class="tok-n">AppState</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-n">List</span><span class="tok-p">[</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingParams</span><span class="tok-p">]:</span>
    <span class="tok-n">alternative_layout</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingParams</span><span class="tok-p">()</span>
    <span class="tok-n">alternative_layout</span><span class="tok-o">.</span><span class="tok-n">layout_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Alternative Layout&quot;</span>
    <span class="tok-n">alternative_layout</span><span class="tok-o">.</span><span class="tok-n">docking_splits</span> <span class="tok-o">=</span> <span class="tok-n">create_alternative_docking_splits</span><span class="tok-p">()</span>
    <span class="tok-n">alternative_layout</span><span class="tok-o">.</span><span class="tok-n">dockable_windows</span> <span class="tok-o">=</span> <span class="tok-n">create_dockable_windows</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>

    <span class="tok-n">tabs_layout</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingParams</span><span class="tok-p">()</span>
    <span class="tok-n">tabs_layout</span><span class="tok-o">.</span><span class="tok-n">layout_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Tabs Layout&quot;</span>
    <span class="tok-n">tabs_layout</span><span class="tok-o">.</span><span class="tok-n">dockable_windows</span> <span class="tok-o">=</span> <span class="tok-n">create_dockable_windows</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-c1"># Force all windows to be presented in the MainDockSpace</span>
    <span class="tok-k">for</span> <span class="tok-n">window</span> <span class="tok-ow">in</span> <span class="tok-n">tabs_layout</span><span class="tok-o">.</span><span class="tok-n">dockable_windows</span><span class="tok-p">:</span>
        <span class="tok-n">window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-c1"># In &quot;Tabs Layout&quot;, no split is created</span>
    <span class="tok-n">tabs_layout</span><span class="tok-o">.</span><span class="tok-n">docking_splits</span> <span class="tok-o">=</span> <span class="tok-p">[]</span>

    <span class="tok-k">return</span> <span class="tok-p">[</span><span class="tok-n">alternative_layout</span><span class="tok-p">,</span> <span class="tok-n">tabs_layout</span><span class="tok-p">]</span>


<span class="tok-c1">##########################################################################</span>
<span class="tok-c1">#    Define the app initial theme</span>
<span class="tok-c1">##########################################################################</span>
<span class="tok-k">def</span> <span class="tok-nf">setup_my_theme</span><span class="tok-p">():</span>
<span class="tok-w">    </span><span class="tok-sd">&quot;&quot;&quot;Example of theme customization at App startup</span>
<span class="tok-sd">    This function is called in the callback `setup_imgui_style` in order to apply a custom theme:</span>
<span class="tok-sd">        runner_params.callbacks.setup_imgui_style = setup_my_theme()</span>
<span class="tok-sd">    &quot;&quot;&quot;</span>
    <span class="tok-c1"># Apply default style</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">imgui_default_settings</span><span class="tok-o">.</span><span class="tok-n">setup_default_imgui_style</span><span class="tok-p">()</span>
    <span class="tok-c1"># Create a tweaked theme</span>
    <span class="tok-n">tweaked_theme</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">ImGuiTweakedTheme</span><span class="tok-p">()</span>
    <span class="tok-n">tweaked_theme</span><span class="tok-o">.</span><span class="tok-n">theme</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">ImGuiTheme_</span><span class="tok-o">.</span><span class="tok-n">material_flat</span>
    <span class="tok-n">tweaked_theme</span><span class="tok-o">.</span><span class="tok-n">tweaks</span><span class="tok-o">.</span><span class="tok-n">rounding</span> <span class="tok-o">=</span> <span class="tok-mf">10.0</span>
    <span class="tok-c1"># Apply the tweaked theme</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">apply_tweaked_theme</span><span class="tok-p">(</span><span class="tok-n">tweaked_theme</span><span class="tok-p">)</span>  <span class="tok-c1"># Note: you can also push/pop the theme in order to apply it only to a specific part of the Gui:  hello_imgui.push_tweaked_theme(tweaked_theme) / hello_imgui.pop_tweaked_theme()</span>
    <span class="tok-c1"># Then apply further modifications to ImGui style</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_style</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">item_spacing</span> <span class="tok-o">=</span> <span class="tok-n">ImVec2</span><span class="tok-p">(</span><span class="tok-mi">6</span><span class="tok-p">,</span> <span class="tok-mi">4</span><span class="tok-p">)</span>  <span class="tok-c1"># Reduce spacing between items ((8, 4) by default)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_style</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">set_color_</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Col_</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">,</span> <span class="tok-p">(</span><span class="tok-mf">0.8</span><span class="tok-p">,</span> <span class="tok-mf">0.8</span><span class="tok-p">,</span> <span class="tok-mf">0.85</span><span class="tok-p">,</span> <span class="tok-mf">1.0</span><span class="tok-p">))</span>  <span class="tok-c1"># Change text color</span>


<span class="tok-c1">##########################################################################</span>
<span class="tok-c1">#    main(): here, we simply fill RunnerParams, then run the application</span>
<span class="tok-c1">##########################################################################</span>
<span class="tok-k">def</span> <span class="tok-nf">main</span><span class="tok-p">():</span>
    <span class="tok-c1"># By default, an assets folder is installed via pip inside site-packages/lg_imgui_bundle/assets</span>
    <span class="tok-c1"># and provides two fonts (fonts/DroidSans.ttf and fonts/fontawesome-webfont.ttf)</span>
    <span class="tok-c1"># If you need to add more assets, make a copy of this assets folder and add your own files,</span>
    <span class="tok-c1"># and call set_assets_folder</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">set_assets_folder</span><span class="tok-p">(</span><span class="tok-n">demo_utils</span><span class="tok-o">.</span><span class="tok-n">demos_assets_folder</span><span class="tok-p">())</span>

    <span class="tok-c1">#</span>
    <span class="tok-c1"># Part 1: Define the application state, fill the status and menu bars, and load additional font</span>
    <span class="tok-c1">#</span>

    <span class="tok-c1"># Our application state</span>
    <span class="tok-n">app_state</span> <span class="tok-o">=</span> <span class="tok-n">AppState</span><span class="tok-p">()</span>

    <span class="tok-c1"># Hello ImGui params (they hold the settings as well as the Gui callbacks)</span>
    <span class="tok-n">runner_params</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">RunnerParams</span><span class="tok-p">()</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">window_title</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Docking Demo&quot;</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">menu_app_title</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Docking Demo&quot;</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">window_geometry</span><span class="tok-o">.</span><span class="tok-n">size</span> <span class="tok-o">=</span> <span class="tok-p">(</span><span class="tok-mi">1000</span><span class="tok-p">,</span> <span class="tok-mi">900</span><span class="tok-p">)</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">restore_previous_geometry</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">borderless</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">borderless_movable</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">borderless_resizable</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">borderless_closable</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>

    <span class="tok-c1"># Set LoadAdditionalFonts callback</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">load_additional_fonts</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">load_fonts</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>

    <span class="tok-c1">#</span>
    <span class="tok-c1"># Status bar</span>
    <span class="tok-c1">#</span>
    <span class="tok-c1"># We use the default status bar of Hello ImGui</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">show_status_bar</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-c1"># Add custom widgets in the status bar</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">show_status</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">status_bar_gui</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-c1"># uncomment next line in order to hide the FPS in the status bar</span>
    <span class="tok-c1"># runner_params.im_gui_window_params.show_status_fps = False</span>

    <span class="tok-c1">#</span>
    <span class="tok-c1"># Menu bar</span>
    <span class="tok-c1">#</span>
    <span class="tok-c1"># Here, we fully customize the menu bar:</span>
    <span class="tok-c1"># by setting `show_menu_bar` to True, and `show_menu_app` and `show_menu_view` to False,</span>
    <span class="tok-c1"># HelloImGui will display an empty menu bar, which we can fill with our own menu items via the callback `show_menus`</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">show_menu_bar</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">show_menu_app</span> <span class="tok-o">=</span> <span class="tok-kc">False</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">show_menu_view</span> <span class="tok-o">=</span> <span class="tok-kc">False</span>
    <span class="tok-c1"># Inside `show_menus`, we can call `hello_imgui.show_view_menu` and `hello_imgui.show_app_menu` if desired</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">show_menus</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">show_menu_gui</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">)</span>
    <span class="tok-c1"># Optional: add items to Hello ImGui default App menu</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">show_app_menu_items</span> <span class="tok-o">=</span> <span class="tok-n">show_app_menu_items</span>

    <span class="tok-c1">#</span>
    <span class="tok-c1"># Top and bottom toolbars</span>
    <span class="tok-c1">#</span>
    <span class="tok-c1"># toolbar options</span>
    <span class="tok-n">edge_toolbar_options</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">EdgeToolbarOptions</span><span class="tok-p">()</span>
    <span class="tok-n">edge_toolbar_options</span><span class="tok-o">.</span><span class="tok-n">size_em</span> <span class="tok-o">=</span> <span class="tok-mf">2.5</span>
    <span class="tok-n">edge_toolbar_options</span><span class="tok-o">.</span><span class="tok-n">window_bg</span> <span class="tok-o">=</span> <span class="tok-n">ImVec4</span><span class="tok-p">(</span><span class="tok-mf">0.8</span><span class="tok-p">,</span> <span class="tok-mf">0.8</span><span class="tok-p">,</span> <span class="tok-mf">0.8</span><span class="tok-p">,</span> <span class="tok-mf">0.35</span><span class="tok-p">)</span>
    <span class="tok-c1"># top toolbar</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">add_edge_toolbar</span><span class="tok-p">(</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">EdgeToolbarType</span><span class="tok-o">.</span><span class="tok-n">top</span><span class="tok-p">,</span>
        <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">show_top_toolbar</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">),</span>
        <span class="tok-n">edge_toolbar_options</span><span class="tok-p">,</span>
    <span class="tok-p">)</span>
    <span class="tok-c1"># right toolbar</span>
    <span class="tok-n">edge_toolbar_options</span><span class="tok-o">.</span><span class="tok-n">window_bg</span><span class="tok-o">.</span><span class="tok-n">w</span> <span class="tok-o">=</span> <span class="tok-mf">0.4</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">add_edge_toolbar</span><span class="tok-p">(</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">EdgeToolbarType</span><span class="tok-o">.</span><span class="tok-n">right</span><span class="tok-p">,</span>
        <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">show_right_toolbar</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">),</span>
        <span class="tok-n">edge_toolbar_options</span><span class="tok-p">,</span>
    <span class="tok-p">)</span>

    <span class="tok-c1">#</span>
    <span class="tok-c1"># Load user settings at callbacks `post_init` and save them at `before_exit`</span>
    <span class="tok-c1">#</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">post_init</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">load_my_app_settings</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">before_exit</span> <span class="tok-o">=</span> <span class="tok-k">lambda</span><span class="tok-p">:</span> <span class="tok-n">save_my_app_settings</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>

    <span class="tok-c1"># Change style</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">setup_imgui_style</span> <span class="tok-o">=</span> <span class="tok-n">setup_my_theme</span>

    <span class="tok-c1">#</span>
    <span class="tok-c1"># Part 2: Define the application layout and windows</span>
    <span class="tok-c1">#</span>

    <span class="tok-c1"># First, tell HelloImGui that we want full screen dock space (this will create &quot;MainDockSpace&quot;)</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">default_imgui_window_type</span> <span class="tok-o">=</span> <span class="tok-p">(</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DefaultImGuiWindowType</span><span class="tok-o">.</span><span class="tok-n">provide_full_screen_dock_space</span>
    <span class="tok-p">)</span>
    <span class="tok-c1"># In this demo, we also demonstrate multiple viewports: you can drag windows outside</span>
    <span class="tok-c1"># out the main window in order to put their content into new native windows</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">enable_viewports</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-c1"># Set the default layout (this contains the default DockingSplits and DockableWindows)</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">docking_params</span> <span class="tok-o">=</span> <span class="tok-n">create_default_layout</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>
    <span class="tok-c1"># Add alternative layouts</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">alternative_docking_layouts</span> <span class="tok-o">=</span> <span class="tok-n">create_alternative_layouts</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-p">)</span>

    <span class="tok-c1">#</span>
    <span class="tok-c1"># Part 3: Where to save the app settings</span>
    <span class="tok-c1">#</span>
    <span class="tok-c1"># tag::app_settings[]</span>
    <span class="tok-c1"># By default, HelloImGui will save the settings in the current folder.</span>
    <span class="tok-c1"># This is convenient when developing, but not so much when deploying the app.</span>
    <span class="tok-c1"># You can tell HelloImGui to save the settings in a specific folder: choose between</span>
    <span class="tok-c1">#         current_folder</span>
    <span class="tok-c1">#         app_user_config_folder</span>
    <span class="tok-c1">#         app_executable_folder</span>
    <span class="tok-c1">#         home_folder</span>
    <span class="tok-c1">#         temp_folder</span>
    <span class="tok-c1">#         documents_folder</span>
    <span class="tok-c1">#</span>
    <span class="tok-c1"># Note: app_user_config_folder is:</span>
    <span class="tok-c1">#         AppData under Windows (Example: C:\Users\[Username]\AppData\Roaming)</span>
    <span class="tok-c1">#         ~/.config under Linux</span>
    <span class="tok-c1">#         &quot;~/Library/Application Support&quot; under macOS or iOS</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">ini_folder_type</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">IniFolderType</span><span class="tok-o">.</span><span class="tok-n">app_user_config_folder</span>

    <span class="tok-c1"># runnerParams.ini_filename: this will be the name of the ini file in which the settings</span>
    <span class="tok-c1"># will be stored.</span>
    <span class="tok-c1"># In this example, the subdirectory Docking_Demo will be created under the folder defined</span>
    <span class="tok-c1"># by runnerParams.ini_folder_type.</span>
    <span class="tok-c1">#</span>
    <span class="tok-c1"># Note: if ini_filename is left empty, the name of the ini file will be derived</span>
    <span class="tok-c1"># from app_window_params.window_title</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">ini_filename</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Docking_Demo/Docking_demo.ini&quot;</span>
    <span class="tok-c1"># end::app_settings[]</span>

    <span class="tok-c1">#</span>
    <span class="tok-c1"># Part 4: Run the app</span>
    <span class="tok-c1">#</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">run</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">)</span>


<span class="tok-k">if</span> <span class="tok-vm">__name__</span> <span class="tok-o">==</span> <span class="tok-s2">&quot;__main__&quot;</span><span class="tok-p">:</span>
    <span class="tok-n">main</span><span class="tok-p">()</span></code></pre>
</div>
</div>
</div>
</details>
</div>
<div class="sect2">
<h3 id="_custom_3d_background">Custom 3D Background</h3>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_custom_background.jpg" alt="demo custom background" width="400">
</div>
<div class="title">Figure 6. Custom 3D Background</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_custom_background.html">Run this demo in your browser</a></p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<div class="title">Tip</div>
</td>
<td class="content">
As shown in the screenshot, Hello ImGui is able to display a custom 3D scene in the background. This is done by using a dedicated callback.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>This demonstration showcases how to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Display a 3D scene in the background via the callback <code>runnerParams.callbacks.CustomBackground</code></p>
</li>
<li>
<p>Load and compile a shader</p>
</li>
<li>
<p>Adjust uniforms in the GUI</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Its source code is heavily documented and should be self-explanatory.</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/pthom/imgui_bundle/blob/main/bindings/imgui_bundle/demos_cpp/demos_immapp/demo_custom_background.cpp">Source code in C&#43;&#43;</a></p>
</li>
<li>
<p><a href="https://github.com/pthom/imgui_bundle/blob/main/bindings/imgui_bundle/demos_python/demos_immapp/demo_custom_background.py">Source code in Python</a></p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="quickstart_testengine">Test &amp; Automation with ImGui Test Engine</h3>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_testengine.jpg" alt="demo testengine" width="300">
</div>
<div class="title">Figure 7. ImmGui Test Engine in action</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_testengine.html">Run this demo in your browser</a></p>
</div>
<div class="paragraph">
<p><a href="https://github.com/ocornut/imgui_test_engine">ImGui Test Engine</a> is a Tests &amp; Automation Engine for Dear ImGui.</p>
</div>
<div class="paragraph">
<p>This demo source code is heavily documented and should be self-explanatory. It shows how to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>enable ImGui Test Engine via RunnerParams.use_imgui_test_engine</p>
</li>
<li>
<p>define a callback where the tests are registered (runner_params.callbacks.register_tests)</p>
</li>
<li>
<p>create tests, and:</p>
<div class="ulist">
<ul>
<li>
<p>automate actions using "named references" (see <a href="https://github.com/ocornut/imgui_test_engine/wiki/Named-References" class="bare">https://github.com/ocornut/imgui_test_engine/wiki/Named-References</a>)</p>
</li>
<li>
<p>display an optional custom GUI for a test</p>
</li>
</ul>
</div>
</li>
<li>
<p>manipulate custom variables</p>
</li>
<li>
<p>check that simulated actions do modify those variables</p>
</li>
</ul>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
See <a href="https://github.com/ocornut/imgui_test_engine/blob/main/imgui_test_engine/LICENSE.txt">Dear ImGui Test Engine License</a>. (TL;DR: free for individuals, educational, open-source and small businesses uses. Paid for larger businesses)
</td>
</tr>
</table>
</div>
<details>
<summary class="title">Click to see its source code in C&#43;&#43;</summary>
<div class="content">
<div class="paragraph">
<p>C&#43;&#43;</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cpp"><span></span><span class="tok-cp">#ifdef HELLOIMGUI_WITH_TEST_ENGINE</span>
<span class="tok-c1">// A demo app that demonstrates how to use ImGui Test Engine (https://github.com/ocornut/imgui_test_engine)</span>
<span class="tok-c1">//</span>
<span class="tok-c1">// It demonstrates how to:</span>
<span class="tok-c1">// - enable ImGui Test Engine via runnerParams.useImGuiTestEngine</span>
<span class="tok-c1">// - define a callback where the tests are registered (runnerParams.callbacks.RegisterTests)</span>
<span class="tok-c1">// - create tests, and:</span>
<span class="tok-c1">//   - automate actions using &quot;named references&quot; (see https://github.com/ocornut/imgui_test_engine/wiki/Named-References)</span>
<span class="tok-c1">//   - display an optional custom GUI for a test</span>
<span class="tok-c1">//   - manipulate custom variables</span>
<span class="tok-c1">//   - check that simulated actions do modify those variables</span>
<span class="tok-c1">//</span>
<span class="tok-c1">// Important note: ImGui Test Engine falls under the Dear ImGui Test Engine License</span>
<span class="tok-c1">//    See: https://github.com/ocornut/imgui_test_engine/blob/main/imgui_test_engine/LICENSE.txt</span>
<span class="tok-c1">//    TL;DR: free for individuals, educational, open-source and small businesses uses.</span>
<span class="tok-c1">//           Paid for larger businesses. Read license for details.</span>
<span class="tok-c1">//           License sales to larger businesses are used to fund and sustain the development of Dear ImGui.</span>

<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;immapp/immapp.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_test_engine/imgui_te_engine.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_test_engine/imgui_te_context.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_test_engine/imgui_te_ui.h&quot;</span>


<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;vector&gt;</span>

<span class="tok-c1">// Our tests, that will automate the application</span>
<span class="tok-n">ImGuiTest</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">testOpenPopup</span><span class="tok-p">;</span>
<span class="tok-n">ImGuiTest</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">testCaptureScreenshot</span><span class="tok-p">;</span>
<span class="tok-n">ImGuiTest</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">testCustomGui</span><span class="tok-p">;</span>

<span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">gShowStackToolWindow</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">nbAltA</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>


<span class="tok-c1">// This function is called at startup and will instantiate the tests</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">MyRegisterTests</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiTestEngine</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">engine</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetImGuiTestEngine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-c1">// Demo 1: Open popup</span>
<span class="tok-w">    </span><span class="tok-n">testOpenPopup</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">IM_REGISTER_TEST</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Demo Tests&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Open Popup&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">testOpenPopupFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-n">ImGuiTestContext</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">ctx</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-c1">// This is the function that will be called by our test</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">SetRef</span><span class="tok-p">(</span><span class="tok-s">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">);</span><span class="tok-w">              </span><span class="tok-c1">// From now on, all actions happen in the &quot;Dear ImGui Demo&quot; window</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemOpen</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Popups &amp; Modal windows&quot;</span><span class="tok-p">);</span><span class="tok-w">     </span><span class="tok-c1">// Open the &quot;Popups &amp; Modal windows&quot; tree item</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemOpen</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Modals&quot;</span><span class="tok-p">);</span><span class="tok-w">                     </span><span class="tok-c1">// Open the &quot;Modal&quot; tree item</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemClick</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Delete..&quot;</span><span class="tok-p">);</span><span class="tok-w">               </span><span class="tok-c1">// Click the &quot;Delete..&quot; button (&quot;**&quot; means: search inside children)</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemClick</span><span class="tok-p">(</span><span class="tok-s">&quot;//Delete?/Cancel&quot;</span><span class="tok-p">);</span><span class="tok-w">          </span><span class="tok-c1">// Click the &quot;Cancel&quot; button:</span>
<span class="tok-w">        </span><span class="tok-c1">//    here, &quot;//&quot;  means &quot;ignore previous set_ref&quot; and search</span>
<span class="tok-w">        </span><span class="tok-c1">//    for the cancel button in the root popup window named &quot;Delete?&quot;</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemClose</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Popups &amp; Modal windows&quot;</span><span class="tok-p">);</span><span class="tok-w">    </span><span class="tok-c1">// Close the &quot;Popups &amp; Modal windows&quot; tree item</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-c1">// Let the test call our function</span>
<span class="tok-w">    </span><span class="tok-n">testOpenPopup</span><span class="tok-o">-&gt;</span><span class="tok-n">TestFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">testOpenPopupFunc</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Demo 2: Capture Dear ImGui Demo window</span>
<span class="tok-w">    </span><span class="tok-n">testCaptureScreenshot</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">IM_REGISTER_TEST</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Demo Tests&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Capture Screenshot&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">testCaptureScreenshotFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-n">ImGuiTestContext</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">ctx</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">SetRef</span><span class="tok-p">(</span><span class="tok-s">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">);</span><span class="tok-w">                   </span><span class="tok-c1">// From now on, actions happen in the &quot;Dear ImGui Demo&quot; window</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemOpen</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Widgets&quot;</span><span class="tok-p">);</span><span class="tok-w">                         </span><span class="tok-c1">// Open the &quot;Widgets&quot;, then &quot;Basic&quot; tree item</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemOpenAll</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Basic&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">CaptureScreenshotWindow</span><span class="tok-p">(</span><span class="tok-s">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-c1">// Capture window and save screenshot</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemClose</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Widgets&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-n">testCaptureScreenshot</span><span class="tok-o">-&gt;</span><span class="tok-n">TestFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">testCaptureScreenshotFunc</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Demo 3: a test with a custom GUI and custom variables</span>
<span class="tok-w">    </span><span class="tok-c1">// which asserts that simulated actions successfully changed the variables values</span>
<span class="tok-w">    </span><span class="tok-n">testCustomGui</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">IM_REGISTER_TEST</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Demo Tests&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Test custom GUI &amp; vars&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-c1">// Our custom variables container</span>
<span class="tok-w">    </span><span class="tok-k">struct</span><span class="tok-w"> </span><span class="tok-nc">TestVar2</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">myInt</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">42</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-n">testCustomGui</span><span class="tok-o">-&gt;</span><span class="tok-n">SetVarsDataType</span><span class="tok-o">&lt;</span><span class="tok-n">TestVar2</span><span class="tok-o">&gt;</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">testCustomGuiFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-n">ImGuiTestContext</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">ctx</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-c1">// Custom GUI for this test: it can edit our custom variable</span>
<span class="tok-w">        </span><span class="tok-n">TestVar2</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">vars</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">GetVars</span><span class="tok-o">&lt;</span><span class="tok-n">TestVar2</span><span class="tok-o">&gt;</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetNextWindowSize</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">EmToVec2</span><span class="tok-p">(</span><span class="tok-mi">40</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">8</span><span class="tok-p">));</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Begin</span><span class="tok-p">(</span><span class="tok-s">&quot;Custom Gui Test Window&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-k">nullptr</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImGuiWindowFlags_NoSavedSettings</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SliderInt</span><span class="tok-p">(</span><span class="tok-s">&quot;Slider&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">vars</span><span class="tok-p">.</span><span class="tok-n">myInt</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">1000</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">End</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">testWithVarsTestFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-n">ImGuiTestContext</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">ctx</span><span class="tok-p">){</span>
<span class="tok-w">        </span><span class="tok-c1">// Our test, that will perform actions in the custom GUI, and assert that actions do change the custom variables</span>
<span class="tok-w">        </span><span class="tok-n">TestVar2</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">vars</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">GetVars</span><span class="tok-o">&lt;</span><span class="tok-n">TestVar2</span><span class="tok-o">&gt;</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">SetRef</span><span class="tok-p">(</span><span class="tok-s">&quot;Custom Gui Test Window&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">IM_CHECK_EQ</span><span class="tok-p">(</span><span class="tok-n">vars</span><span class="tok-p">.</span><span class="tok-n">myInt</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">42</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemInputValue</span><span class="tok-p">(</span><span class="tok-s">&quot;Slider&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">123</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">IM_CHECK_EQ</span><span class="tok-p">(</span><span class="tok-n">vars</span><span class="tok-p">.</span><span class="tok-n">myInt</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">123</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-c1">// Let the test call our test function, and also call our custom GUI</span>
<span class="tok-w">    </span><span class="tok-n">testCustomGui</span><span class="tok-o">-&gt;</span><span class="tok-n">TestFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">testWithVarsTestFunc</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">testCustomGui</span><span class="tok-o">-&gt;</span><span class="tok-n">GuiFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">testCustomGuiFunc</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Demo 4: Write to text field</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">testWrite</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">IM_REGISTER_TEST</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Demo Tests&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Write to text field&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">testWriteFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-n">ImGuiTestContext</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">ctx</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">SetRef</span><span class="tok-p">(</span><span class="tok-s">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemOpen</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Widgets&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemOpen</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Text Input&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemOpen</span><span class="tok-p">(</span><span class="tok-s">&quot;**/Multi-line Text Input&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">ItemClick</span><span class="tok-p">(</span><span class="tok-s">&quot;**/##source&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">KeyChars</span><span class="tok-p">(</span><span class="tok-s">&quot;Hello from test engine!&quot;</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-c1">// Note: ctx.KeyUp/Down/Press also send events that you can process in the GUI</span>
<span class="tok-w">        </span><span class="tok-c1">//       However, you need to use KeyChars to input text in the text widgets</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-n">testWrite</span><span class="tok-o">-&gt;</span><span class="tok-n">TestFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">testWriteFunc</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Demo 5: Press Alt+A</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">testAltA</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">IM_REGISTER_TEST</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Demo Tests&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Test key combination (Alt-A)&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">testAltAFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-n">ImGuiTestContext</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">ctx</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">KeyDown</span><span class="tok-p">(</span><span class="tok-n">ImGuiKey_LeftAlt</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">KeyDown</span><span class="tok-p">(</span><span class="tok-n">ImGuiKey_A</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">KeyUp</span><span class="tok-p">(</span><span class="tok-n">ImGuiKey_A</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ctx</span><span class="tok-o">-&gt;</span><span class="tok-n">KeyUp</span><span class="tok-p">(</span><span class="tok-n">ImGuiKey_LeftAlt</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-n">testAltA</span><span class="tok-o">-&gt;</span><span class="tok-n">TestFunc</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">testAltAFunc</span><span class="tok-p">;</span>
<span class="tok-p">}</span>


<span class="tok-c1">// Our application GUI: shows that we can trigger the test manually</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">MyGui</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Checkbox</span><span class="tok-p">(</span><span class="tok-s">&quot;Show ID Stack Tool Window&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">gShowStackToolWindow</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetTooltip</span><span class="tok-p">(</span><span class="tok-s">&quot;This tool window can help to identify the ID of the widgets (use </span><span class="tok-se">\&quot;</span><span class="tok-s">Copy path to clipboard</span><span class="tok-se">\&quot;</span><span class="tok-s">)&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">gShowStackToolWindow</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">ShowIDStackToolWindow</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGuiTestEngine</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">testEngine</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetImGuiTestEngine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Run </span><span class="tok-se">\&quot;</span><span class="tok-s">Open popup</span><span class="tok-se">\&quot;</span><span class="tok-s">&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">ImGuiTestEngine_QueueTest</span><span class="tok-p">(</span><span class="tok-n">testEngine</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">testOpenPopup</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Run </span><span class="tok-se">\&quot;</span><span class="tok-s">Capture Screenshot</span><span class="tok-se">\&quot;</span><span class="tok-s">&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">ImGuiTestEngine_QueueTest</span><span class="tok-p">(</span><span class="tok-n">testEngine</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">testCaptureScreenshot</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Run </span><span class="tok-se">\&quot;</span><span class="tok-s">Test custom GUI &amp; vars</span><span class="tok-se">\&quot;</span><span class="tok-s">&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">ImGuiTestEngine_QueueTest</span><span class="tok-p">(</span><span class="tok-n">testEngine</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">testCustomGui</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImGuiTestEngineIO</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">engineIo</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTestEngine_GetIO</span><span class="tok-p">(</span><span class="tok-n">testEngine</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Speed:&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Fast&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">engineIo</span><span class="tok-p">.</span><span class="tok-n">ConfigRunSpeed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTestRunSpeed_Fast</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Normal&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">engineIo</span><span class="tok-p">.</span><span class="tok-n">ConfigRunSpeed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTestRunSpeed_Normal</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Cinematic&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">engineIo</span><span class="tok-p">.</span><span class="tok-n">ConfigRunSpeed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTestRunSpeed_Cinematic</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsKeyPressed</span><span class="tok-p">(</span><span class="tok-n">ImGuiKey_A</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsKeyDown</span><span class="tok-p">(</span><span class="tok-n">ImGuiKey_LeftAlt</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">nbAltA</span><span class="tok-o">++</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">nbAltA</span><span class="tok-w"> </span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Alt-A combination was pressed&quot;</span><span class="tok-p">);</span>
<span class="tok-p">}</span>

<span class="tok-c1">// Defined later: helps to define the application layout, display the ImGui Demo, &amp; ImGui Test Engine Window</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">ApplyApplicationLayout</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">RunnerParams</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">runnerParams</span><span class="tok-p">);</span>


<span class="tok-c1">// Our main function, where we need to:</span>
<span class="tok-c1">// - instantiate RunnerParams</span>
<span class="tok-c1">// - set `runnerParams.useImGuiTestEngine = true`</span>
<span class="tok-c1">// - fill `runnerParams.callbacks.registerTests`</span>
<span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-nf">main</span><span class="tok-p">(</span><span class="tok-kt">int</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-kt">char</span><span class="tok-o">**</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// Instantiate RunnerParams</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">RunnerParams</span><span class="tok-w"> </span><span class="tok-n">runnerParams</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Apply the application layout configuration</span>
<span class="tok-w">    </span><span class="tok-n">ApplyApplicationLayout</span><span class="tok-p">(</span><span class="tok-o">&amp;</span><span class="tok-n">runnerParams</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-c1">// Enable ImGui Test Engine</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">useImGuiTestEngine</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Set the test registration function</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-p">.</span><span class="tok-n">callbacks</span><span class="tok-p">.</span><span class="tok-n">RegisterTests</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">MyRegisterTests</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Run the ImGui application</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Run</span><span class="tok-p">(</span><span class="tok-n">runnerParams</span><span class="tok-p">);</span>
<span class="tok-p">}</span>


<span class="tok-c1">///////////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1">// End of demo code</span>
<span class="tok-c1">///////////////////////////////////////////////////////////////////////////////</span>


<span class="tok-c1">// Define the default docking splits for the application layout</span>
<span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">CreateDefaultDockingSplits</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// Define the application layout: split the window into 3 spaces</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-w"> </span><span class="tok-n">splitMainDemo</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainDemo</span><span class="tok-p">.</span><span class="tok-n">initialDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainDemo</span><span class="tok-p">.</span><span class="tok-n">newDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;ImGuiDemoSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainDemo</span><span class="tok-p">.</span><span class="tok-n">direction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiDir_Right</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainDemo</span><span class="tok-p">.</span><span class="tok-n">ratio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.5f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingSplit</span><span class="tok-w"> </span><span class="tok-n">splitMainTest</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainTest</span><span class="tok-p">.</span><span class="tok-n">initialDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainTest</span><span class="tok-p">.</span><span class="tok-n">newDock</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;TestEngineSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainTest</span><span class="tok-p">.</span><span class="tok-n">direction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiDir_Down</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">splitMainTest</span><span class="tok-p">.</span><span class="tok-n">ratio</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.7f</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-n">splitMainDemo</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">splitMainTest</span><span class="tok-p">};</span>
<span class="tok-p">}</span>

<span class="tok-c1">// Define the dockable windows for the application layout</span>
<span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">CreateDockableWindows</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// Define the app windows: MyGui, ImGui Demo Window, Dear ImGui Test Engine</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">myWindow</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">myWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Run Demos&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">myWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;MainDockSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">myWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">MyGui</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;ImGuiDemoSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">ShowDemoWindow</span><span class="tok-p">();</span><span class="tok-w"> </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockableWindow</span><span class="tok-w"> </span><span class="tok-n">testEngineWindow</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">testEngineWindow</span><span class="tok-p">.</span><span class="tok-n">label</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Dear ImGui Test Engine&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">testEngineWindow</span><span class="tok-p">.</span><span class="tok-n">dockSpaceName</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;TestEngineSpace&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">testEngineWindow</span><span class="tok-p">.</span><span class="tok-n">GuiFunction</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]()</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">ImGuiTestEngine_ShowTestEngineWindows</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">GetImGuiTestEngine</span><span class="tok-p">(),</span><span class="tok-w"> </span><span class="tok-k">nullptr</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-n">myWindow</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">dearImGuiDemoWindow</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">testEngineWindow</span><span class="tok-p">};</span>
<span class="tok-p">}</span>


<span class="tok-c1">// Apply the application layout and windows to the runner parameters</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-n">ApplyApplicationLayout</span><span class="tok-p">(</span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">RunnerParams</span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">runnerParams</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-c1">// Define the application layout and windows</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-o">-&gt;</span><span class="tok-n">appWindowParams</span><span class="tok-p">.</span><span class="tok-n">windowTitle</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Demo ImGui Test Engine&quot;</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-o">-&gt;</span><span class="tok-n">imGuiWindowParams</span><span class="tok-p">.</span><span class="tok-n">defaultImGuiWindowType</span><span class="tok-w"> </span><span class="tok-o">=</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DefaultImGuiWindowType</span><span class="tok-o">::</span><span class="tok-n">ProvideFullScreenDockSpace</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-o">-&gt;</span><span class="tok-n">dockingParams</span><span class="tok-p">.</span><span class="tok-n">dockingSplits</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateDefaultDockingSplits</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-o">-&gt;</span><span class="tok-n">dockingParams</span><span class="tok-p">.</span><span class="tok-n">dockableWindows</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">CreateDockableWindows</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">runnerParams</span><span class="tok-o">-&gt;</span><span class="tok-n">dockingParams</span><span class="tok-p">.</span><span class="tok-n">layoutCondition</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">DockingLayoutCondition</span><span class="tok-o">::</span><span class="tok-n">ApplicationStart</span><span class="tok-p">;</span>
<span class="tok-p">}</span>
<span class="tok-cp">#else </span><span class="tok-c1">// #ifdef HELLOIMGUI_WITH_TEST_ENGINE</span>
<span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">main</span><span class="tok-p">(</span><span class="tok-kt">int</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-kt">char</span><span class="tok-o">**</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-p">{}</span>
<span class="tok-cp">#endif </span><span class="tok-c1">// #ifdef HELLOIMGUI_WITH_TEST_ENGINE</span></code></pre>
</div>
</div>
</div>
</details>
<details>
<summary class="title">Click to see its source code in Python</summary>
<div class="content">
<div class="paragraph">
<p>Python:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="python"><span></span><span class="tok-c1"># A demo app that demonstrates how to use ImGui Test Engine (https://github.com/ocornut/imgui_test_engine)</span>
<span class="tok-c1">#</span>
<span class="tok-c1"># It demonstrates how to:</span>
<span class="tok-c1"># - enable ImGui Test Engine via RunnerParams.use_imgui_test_engine</span>
<span class="tok-c1"># - define a callback where the tests are registered (runner_params.callbacks.register_tests)</span>
<span class="tok-c1"># - create tests, and:</span>
<span class="tok-c1">#   - automate actions using &quot;named references&quot; (see https://github.com/ocornut/imgui_test_engine/wiki/Named-References)</span>
<span class="tok-c1">#   - display an optional custom GUI for a test</span>
<span class="tok-c1">#   - manipulate custom variables</span>
<span class="tok-c1">#   - check that simulated actions do modify those variables</span>
<span class="tok-c1">#</span>
<span class="tok-c1"># Important note: ImGui Test Engine falls under the Dear ImGui Test Engine License</span>
<span class="tok-c1">#     See: https://github.com/ocornut/imgui_test_engine/blob/main/imgui_test_engine/LICENSE.txt</span>
<span class="tok-c1">#     TL;DR: free for individuals, educational, open-source and small businesses uses.</span>
<span class="tok-c1">#            Paid for larger businesses. Read license for details.</span>
<span class="tok-c1">#            License sales to larger businesses are used to fund and sustain the development of Dear ImGui.</span>


<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">imgui</span><span class="tok-p">,</span> <span class="tok-n">hello_imgui</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle.imgui.test_engine_checks</span> <span class="tok-kn">import</span> <span class="tok-n">CHECK</span>
<span class="tok-kn">from</span> <span class="tok-nn">typing</span> <span class="tok-kn">import</span> <span class="tok-n">List</span>


<span class="tok-c1"># Our tests, that will automate the application</span>
<span class="tok-n">test_open_popup</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">Test</span>
<span class="tok-n">test_capture_screenshot</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">Test</span>
<span class="tok-n">test_custom_gui</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">Test</span>

<span class="tok-n">g_show_stack_tool_window</span> <span class="tok-o">=</span> <span class="tok-kc">False</span>
<span class="tok-n">nb_alt_a</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>


<span class="tok-c1"># This function is called at startup and will instantiate the tests</span>
<span class="tok-k">def</span> <span class="tok-nf">my_register_tests</span><span class="tok-p">():</span>
    <span class="tok-c1"># fmt: off</span>
    <span class="tok-k">global</span> <span class="tok-n">test_open_popup</span><span class="tok-p">,</span> <span class="tok-n">test_capture_screenshot</span><span class="tok-p">,</span> <span class="tok-n">test_custom_gui</span>
    <span class="tok-n">engine</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_imgui_test_engine</span><span class="tok-p">()</span>

    <span class="tok-c1"># Demo 1: Open popup</span>
    <span class="tok-n">test_open_popup</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">register_test</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Demo Tests&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Open Popup&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">def</span> <span class="tok-nf">test_open_popup_func</span><span class="tok-p">(</span><span class="tok-n">ctx</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestContext</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
        <span class="tok-c1"># This is the function that will be called by our test</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">set_ref</span><span class="tok-p">(</span><span class="tok-s2">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">)</span>              <span class="tok-c1"># From now on, all actions happen in the &quot;Dear ImGui Demo&quot; window</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_open</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Popups &amp; Modal windows&quot;</span><span class="tok-p">)</span>     <span class="tok-c1"># Open the &quot;Popups &amp; Modal windows&quot; tree item</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_open</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Modals&quot;</span><span class="tok-p">)</span>                     <span class="tok-c1"># Open the &quot;Modal&quot; tree item</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_click</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Delete..&quot;</span><span class="tok-p">)</span>               <span class="tok-c1"># Click the &quot;Delete..&quot; button (&quot;**&quot; means: search inside children)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_click</span><span class="tok-p">(</span><span class="tok-s2">&quot;//Delete?/Cancel&quot;</span><span class="tok-p">)</span>          <span class="tok-c1"># Click the &quot;Cancel&quot; button:</span>
                                                    <span class="tok-c1">#    here, &quot;//&quot;  means &quot;ignore previous set_ref&quot; and search</span>
                                                    <span class="tok-c1">#    for the cancel button in the root popup window named &quot;Delete?&quot;</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_close</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Popups &amp; Modal windows&quot;</span><span class="tok-p">)</span>    <span class="tok-c1"># Close the &quot;Popups &amp; Modal windows&quot; tree item</span>
    <span class="tok-c1"># let the test call our function</span>
    <span class="tok-n">test_open_popup</span><span class="tok-o">.</span><span class="tok-n">test_func</span> <span class="tok-o">=</span> <span class="tok-n">test_open_popup_func</span>

    <span class="tok-c1"># Demo 2 : Capture Dear ImGui Demo window</span>
    <span class="tok-n">test_capture_screenshot</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">register_test</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Demo Tests&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Capture Screenshot&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">def</span> <span class="tok-nf">test_capture_screenshot_func</span><span class="tok-p">(</span><span class="tok-n">ctx</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestContext</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">set_ref</span><span class="tok-p">(</span><span class="tok-s2">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">)</span>                   <span class="tok-c1"># From now on, actions happen in the &quot;Dear ImGui Demo&quot; window</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_open</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Widgets&quot;</span><span class="tok-p">)</span>                         <span class="tok-c1"># Open the &quot;Widgets&quot;, then &quot;Basic&quot; tree item</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_open_all</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Basic&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">capture_screenshot_window</span><span class="tok-p">(</span><span class="tok-s2">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">)</span> <span class="tok-c1"># Capture window and save screenshot</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_close</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Widgets&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">test_capture_screenshot</span><span class="tok-o">.</span><span class="tok-n">test_func</span> <span class="tok-o">=</span> <span class="tok-n">test_capture_screenshot_func</span>

    <span class="tok-c1"># Demo 3: a test with a custom GUI and custom variables</span>
    <span class="tok-c1">#         which asserts that simulated actions successfully changed the variables values</span>
    <span class="tok-n">test_custom_gui</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">register_test</span><span class="tok-p">(</span>
        <span class="tok-n">engine</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Demo Tests&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Test custom GUI &amp; vars&quot;</span>
    <span class="tok-p">)</span>
    <span class="tok-c1"># Our custom variables container</span>
    <span class="tok-k">class</span> <span class="tok-nc">TestVar2</span><span class="tok-p">:</span>
        <span class="tok-n">my_int</span> <span class="tok-o">=</span> <span class="tok-mi">42</span>

    <span class="tok-n">test_var2</span> <span class="tok-o">=</span> <span class="tok-n">TestVar2</span><span class="tok-p">()</span>  <span class="tok-c1"># our custom variable(s)</span>

    <span class="tok-k">def</span> <span class="tok-nf">test_custom_gui_func</span><span class="tok-p">(</span><span class="tok-n">ctx</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestContext</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
        <span class="tok-c1"># Custom GUI for this test: it can edit our custom variable</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_next_window_size</span><span class="tok-p">(</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">em_to_vec2</span><span class="tok-p">(</span><span class="tok-mi">40</span><span class="tok-p">,</span> <span class="tok-mi">8</span><span class="tok-p">))</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin</span><span class="tok-p">(</span>
            <span class="tok-s2">&quot;Custom Gui Test Window&quot;</span><span class="tok-p">,</span> <span class="tok-kc">None</span><span class="tok-p">,</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">WindowFlags_</span><span class="tok-o">.</span><span class="tok-n">no_saved_settings</span>
        <span class="tok-p">)</span>
        <span class="tok-n">_</span><span class="tok-p">,</span> <span class="tok-n">test_var2</span><span class="tok-o">.</span><span class="tok-n">my_int</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">slider_int</span><span class="tok-p">(</span><span class="tok-s2">&quot;Slider&quot;</span><span class="tok-p">,</span> <span class="tok-n">test_var2</span><span class="tok-o">.</span><span class="tok-n">my_int</span><span class="tok-p">,</span> <span class="tok-mi">0</span><span class="tok-p">,</span> <span class="tok-mi">1000</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end</span><span class="tok-p">()</span>

    <span class="tok-k">def</span> <span class="tok-nf">test_with_vars_test_func</span><span class="tok-p">(</span><span class="tok-n">ctx</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestContext</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
        <span class="tok-c1"># Our test, that will perform actions in the custom GUI, and assert that actions do change the custom variables</span>
        <span class="tok-c1"># Optional: reset test_var2 to its startup values</span>
        <span class="tok-k">nonlocal</span> <span class="tok-n">test_var2</span>
        <span class="tok-n">test_var2</span> <span class="tok-o">=</span> <span class="tok-n">TestVar2</span><span class="tok-p">()</span>
        <span class="tok-c1"># Run the test</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">set_ref</span><span class="tok-p">(</span><span class="tok-s2">&quot;Custom Gui Test Window&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">CHECK</span><span class="tok-p">(</span><span class="tok-n">test_var2</span><span class="tok-o">.</span><span class="tok-n">my_int</span> <span class="tok-o">==</span> <span class="tok-mi">42</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_input_value</span><span class="tok-p">(</span><span class="tok-s2">&quot;Slider&quot;</span><span class="tok-p">,</span> <span class="tok-mi">123</span><span class="tok-p">)</span>
        <span class="tok-n">CHECK</span><span class="tok-p">(</span><span class="tok-n">test_var2</span><span class="tok-o">.</span><span class="tok-n">my_int</span> <span class="tok-o">==</span> <span class="tok-mi">123</span><span class="tok-p">)</span>

    <span class="tok-c1"># let the test call our test function, and also call our custom Gui</span>
    <span class="tok-n">test_custom_gui</span><span class="tok-o">.</span><span class="tok-n">test_func</span> <span class="tok-o">=</span> <span class="tok-n">test_with_vars_test_func</span>
    <span class="tok-n">test_custom_gui</span><span class="tok-o">.</span><span class="tok-n">gui_func</span> <span class="tok-o">=</span> <span class="tok-n">test_custom_gui_func</span>
    <span class="tok-c1"># fmt: on</span>

    <span class="tok-c1"># Demo 4: Write to text field</span>
    <span class="tok-n">test_write</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">register_test</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Demo Tests&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Write to text field&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">def</span> <span class="tok-nf">test_write_func</span><span class="tok-p">(</span><span class="tok-n">ctx</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestContext</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">set_ref</span><span class="tok-p">(</span><span class="tok-s2">&quot;Dear ImGui Demo&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_open</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Widgets&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_open</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Text Input&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_open</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/Multi-line Text Input&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">item_click</span><span class="tok-p">(</span><span class="tok-s2">&quot;**/##source&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">key_chars</span><span class="tok-p">(</span><span class="tok-s2">&quot;Hello from test engine!&quot;</span><span class="tok-p">)</span>
        <span class="tok-c1"># Note: ctx.key_up/down/key_press also send events that you can process in the GUI</span>
        <span class="tok-c1">#       However, you need to use key_chars to input text in the text widgets</span>
    <span class="tok-n">test_write</span><span class="tok-o">.</span><span class="tok-n">test_func</span> <span class="tok-o">=</span> <span class="tok-n">test_write_func</span>

    <span class="tok-c1"># Demo 5: Press Alt+A</span>
    <span class="tok-n">test_alt_a</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">register_test</span><span class="tok-p">(</span><span class="tok-n">engine</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Demo Tests&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Test key combination (Alt-A)&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">def</span> <span class="tok-nf">test_alt_a_func</span><span class="tok-p">(</span><span class="tok-n">ctx</span><span class="tok-p">:</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestContext</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">key_down</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Key</span><span class="tok-o">.</span><span class="tok-n">left_alt</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">key_down</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Key</span><span class="tok-o">.</span><span class="tok-n">a</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">key_up</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Key</span><span class="tok-o">.</span><span class="tok-n">a</span><span class="tok-p">)</span>
        <span class="tok-n">ctx</span><span class="tok-o">.</span><span class="tok-n">key_up</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Key</span><span class="tok-o">.</span><span class="tok-n">left_alt</span><span class="tok-p">)</span>
    <span class="tok-n">test_alt_a</span><span class="tok-o">.</span><span class="tok-n">test_func</span> <span class="tok-o">=</span> <span class="tok-n">test_alt_a_func</span>


<span class="tok-c1"># Our application GUI: shows that we can trigger the test manually</span>
<span class="tok-k">def</span> <span class="tok-nf">my_gui</span><span class="tok-p">():</span>
    <span class="tok-k">global</span> <span class="tok-n">g_show_stack_tool_window</span>
    <span class="tok-n">_</span><span class="tok-p">,</span> <span class="tok-n">g_show_stack_tool_window</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">checkbox</span><span class="tok-p">(</span><span class="tok-s2">&quot;Show ID Stack Tool Window&quot;</span><span class="tok-p">,</span> <span class="tok-n">g_show_stack_tool_window</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;This tool window can help to identify the ID of the widgets (use </span><span class="tok-se">\&quot;</span><span class="tok-s2">Copy path to clipboard</span><span class="tok-se">\&quot;</span><span class="tok-s2">)&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">g_show_stack_tool_window</span><span class="tok-p">:</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">show_id_stack_tool_window</span><span class="tok-p">()</span>

    <span class="tok-n">test_engine</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_imgui_test_engine</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s1">&#39;Run &quot;Open popup&quot;&#39;</span><span class="tok-p">):</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">queue_test</span><span class="tok-p">(</span><span class="tok-n">test_engine</span><span class="tok-p">,</span> <span class="tok-n">test_open_popup</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s1">&#39;Run &quot;Capture Screenshot&quot;&#39;</span><span class="tok-p">):</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">queue_test</span><span class="tok-p">(</span><span class="tok-n">test_engine</span><span class="tok-p">,</span> <span class="tok-n">test_capture_screenshot</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s1">&#39;Run &quot;Test custom GUI &amp; vars&quot;&#39;</span><span class="tok-p">):</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">queue_test</span><span class="tok-p">(</span><span class="tok-n">test_engine</span><span class="tok-p">,</span> <span class="tok-n">test_custom_gui</span><span class="tok-p">)</span>

    <span class="tok-n">engine_io</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">get_io</span><span class="tok-p">(</span><span class="tok-n">test_engine</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Speed:&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Fast&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">engine_io</span><span class="tok-o">.</span><span class="tok-n">config_run_speed</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestRunSpeed</span><span class="tok-o">.</span><span class="tok-n">fast</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Normal&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">engine_io</span><span class="tok-o">.</span><span class="tok-n">config_run_speed</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestRunSpeed</span><span class="tok-o">.</span><span class="tok-n">normal</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Cinematic&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">engine_io</span><span class="tok-o">.</span><span class="tok-n">config_run_speed</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">TestRunSpeed</span><span class="tok-o">.</span><span class="tok-n">cinematic</span>

    <span class="tok-k">global</span> <span class="tok-n">nb_alt_a</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_key_down</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Key</span><span class="tok-o">.</span><span class="tok-n">left_alt</span><span class="tok-p">)</span> <span class="tok-ow">and</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_key_down</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Key</span><span class="tok-o">.</span><span class="tok-n">a</span><span class="tok-p">):</span>
        <span class="tok-n">nb_alt_a</span> <span class="tok-o">+=</span> <span class="tok-mi">1</span>
    <span class="tok-k">if</span> <span class="tok-n">nb_alt_a</span> <span class="tok-o">&gt;</span> <span class="tok-mi">0</span><span class="tok-p">:</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Alt-A combination was pressed&quot;</span><span class="tok-p">)</span>


<span class="tok-c1"># Defined later: helps to define the application layout, display the ImGui Demo, &amp; ImGui Test Engine Window</span>
<span class="tok-k">def</span> <span class="tok-nf">apply_application_layout</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">:</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">RunnerParams</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
    <span class="tok-o">...</span>


<span class="tok-c1"># Our main  function, where we need to:</span>
<span class="tok-c1">#        - instantiate RunnerParams</span>
<span class="tok-c1">#        - set `runner_params.use_imgui_test_engine = True`</span>
<span class="tok-c1">#        - fill `runner_params.callbacks.register_tests`</span>
<span class="tok-k">def</span> <span class="tok-nf">main</span><span class="tok-p">()</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
    <span class="tok-n">runner_params</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">RunnerParams</span><span class="tok-p">()</span>
    <span class="tok-n">apply_application_layout</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">)</span>

    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">use_imgui_test_engine</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">callbacks</span><span class="tok-o">.</span><span class="tok-n">register_tests</span> <span class="tok-o">=</span> <span class="tok-n">my_register_tests</span>

    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">run</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">)</span>


<span class="tok-c1"># ///////////////////////////////////////////////////////////////////////////////</span>
<span class="tok-c1"># // End of demo code</span>
<span class="tok-c1"># ///////////////////////////////////////////////////////////////////////////////</span>


<span class="tok-c1"># //</span>
<span class="tok-c1"># // Note: the code below only helps to</span>
<span class="tok-c1"># //    - define the application layout</span>
<span class="tok-c1"># //    - display the ImGui Demo Window</span>
<span class="tok-c1"># //    - display the ImGui Test Engine Window</span>


<span class="tok-k">def</span> <span class="tok-nf">create_default_docking_splits</span><span class="tok-p">()</span> <span class="tok-o">-&gt;</span> <span class="tok-n">List</span><span class="tok-p">[</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">]:</span>
    <span class="tok-c1"># Define the application layout: splits the window in 3 spaces</span>
    <span class="tok-n">split_main_demo</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">()</span>
    <span class="tok-n">split_main_demo</span><span class="tok-o">.</span><span class="tok-n">initial_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">split_main_demo</span><span class="tok-o">.</span><span class="tok-n">new_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;ImGuiDemoSpace&quot;</span>
    <span class="tok-n">split_main_demo</span><span class="tok-o">.</span><span class="tok-n">direction</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Dir</span><span class="tok-o">.</span><span class="tok-n">right</span>
    <span class="tok-n">split_main_demo</span><span class="tok-o">.</span><span class="tok-n">ratio</span> <span class="tok-o">=</span> <span class="tok-mf">0.5</span>

    <span class="tok-n">split_main_test</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingSplit</span><span class="tok-p">()</span>
    <span class="tok-n">split_main_test</span><span class="tok-o">.</span><span class="tok-n">initial_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">split_main_test</span><span class="tok-o">.</span><span class="tok-n">new_dock</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;TestEngineSpace&quot;</span>
    <span class="tok-n">split_main_test</span><span class="tok-o">.</span><span class="tok-n">direction</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Dir</span><span class="tok-o">.</span><span class="tok-n">down</span>
    <span class="tok-n">split_main_test</span><span class="tok-o">.</span><span class="tok-n">ratio</span> <span class="tok-o">=</span> <span class="tok-mf">0.7</span>

    <span class="tok-k">return</span> <span class="tok-p">[</span><span class="tok-n">split_main_demo</span><span class="tok-p">,</span> <span class="tok-n">split_main_test</span><span class="tok-p">]</span>


<span class="tok-k">def</span> <span class="tok-nf">create_dockable_windows</span><span class="tok-p">()</span> <span class="tok-o">-&gt;</span> <span class="tok-n">List</span><span class="tok-p">[</span><span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">]:</span>
    <span class="tok-c1"># Define the app windows: my_gui, ImGui Demo Window, Dear ImGui Test Engine</span>
    <span class="tok-n">my_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
    <span class="tok-n">my_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Run Demos&quot;</span>
    <span class="tok-n">my_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;MainDockSpace&quot;</span>
    <span class="tok-n">my_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-n">my_gui</span>

    <span class="tok-n">dear_imgui_demo_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
    <span class="tok-n">dear_imgui_demo_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Dear ImGui Demo&quot;</span>
    <span class="tok-n">dear_imgui_demo_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;ImGuiDemoSpace&quot;</span>
    <span class="tok-n">dear_imgui_demo_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">show_demo_window</span>  <span class="tok-c1"># type: ignore</span>

    <span class="tok-n">test_engine_window</span> <span class="tok-o">=</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockableWindow</span><span class="tok-p">()</span>
    <span class="tok-n">test_engine_window</span><span class="tok-o">.</span><span class="tok-n">label</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Dear ImGui Test Engine&quot;</span>
    <span class="tok-n">test_engine_window</span><span class="tok-o">.</span><span class="tok-n">dock_space_name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;TestEngineSpace&quot;</span>

    <span class="tok-k">def</span> <span class="tok-nf">show_test_engine_windows</span><span class="tok-p">():</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">test_engine</span><span class="tok-o">.</span><span class="tok-n">show_test_engine_windows</span><span class="tok-p">(</span>
            <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">get_imgui_test_engine</span><span class="tok-p">(),</span> <span class="tok-kc">True</span>
        <span class="tok-p">)</span>

    <span class="tok-n">test_engine_window</span><span class="tok-o">.</span><span class="tok-n">gui_function</span> <span class="tok-o">=</span> <span class="tok-n">show_test_engine_windows</span>

    <span class="tok-k">return</span> <span class="tok-p">[</span><span class="tok-n">my_window</span><span class="tok-p">,</span> <span class="tok-n">dear_imgui_demo_window</span><span class="tok-p">,</span> <span class="tok-n">test_engine_window</span><span class="tok-p">]</span>


<span class="tok-k">def</span> <span class="tok-nf">apply_application_layout</span><span class="tok-p">(</span><span class="tok-n">runner_params</span><span class="tok-p">:</span> <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">RunnerParams</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-kc">None</span><span class="tok-p">:</span>  <span class="tok-c1"># type: ignore # noqa: F811</span>
    <span class="tok-c1"># Define the application layout and windows</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">app_window_params</span><span class="tok-o">.</span><span class="tok-n">window_title</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Demo ImGui Test Engine&quot;</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">imgui_window_params</span><span class="tok-o">.</span><span class="tok-n">default_imgui_window_type</span> <span class="tok-o">=</span> <span class="tok-p">(</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DefaultImGuiWindowType</span><span class="tok-o">.</span><span class="tok-n">provide_full_screen_dock_space</span>
    <span class="tok-p">)</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">docking_params</span><span class="tok-o">.</span><span class="tok-n">docking_splits</span> <span class="tok-o">=</span> <span class="tok-n">create_default_docking_splits</span><span class="tok-p">()</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">docking_params</span><span class="tok-o">.</span><span class="tok-n">dockable_windows</span> <span class="tok-o">=</span> <span class="tok-n">create_dockable_windows</span><span class="tok-p">()</span>
    <span class="tok-n">runner_params</span><span class="tok-o">.</span><span class="tok-n">docking_params</span><span class="tok-o">.</span><span class="tok-n">layout_condition</span> <span class="tok-o">=</span> <span class="tok-p">(</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">DockingLayoutCondition</span><span class="tok-o">.</span><span class="tok-n">application_start</span>
    <span class="tok-p">)</span>


<span class="tok-k">if</span> <span class="tok-vm">__name__</span> <span class="tok-o">==</span> <span class="tok-s2">&quot;__main__&quot;</span><span class="tok-p">:</span>
    <span class="tok-n">main</span><span class="tok-p">()</span></code></pre>
</div>
</div>
</div>
</details>
</div>
<div class="sect2">
<h3 id="_display_analyze_images_with_immvision">Display &amp; analyze images with ImmVision</h3>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_immvision_process_1.jpg" alt="demo immvision process 1" width="400">
</div>
<div class="title">Figure 8. Immvision in action</div>
</div>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_immvision_process_2.jpg" alt="demo immvision process 2" width="400">
</div>
<div class="title">Figure 9. Zooming on the images (with the mouse wheel) to display pixel values</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_immvision_process.html">Run this demo in your browser</a></p>
</div>
<div class="paragraph">
<p><a href="https://github.com/pthom/immvision">ImmVision</a>, is an immediate image debugger which can display multiple kinds of images (RGB, RGBA, float, etc.), zoom to examine precise pixel values, display float images with a versatile colormap, etc.</p>
</div>
<div class="paragraph">
<p>This demonstration showcases how to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>display two versions of an image, before after an image processing pipeline</p>
</li>
<li>
<p>zoom on specific ROI of those images to see pixel values</p>
</li>
<li>
<p>play with the parameter of the image processing pipeline</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Its source code is heavily documented and should be self-explanatory.</p>
</div>
<details>
<summary class="title">Click to see its source code in C&#43;&#43;</summary>
<div class="content">
<div class="paragraph">
<p>C&#43;&#43;</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cpp"><span></span><span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;demo_utils/api_demos.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;immvision/immvision.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;immapp/immapp.h&quot;</span>

<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;opencv2/core.hpp&gt;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;opencv2/imgproc.hpp&gt;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;opencv2/imgcodecs.hpp&gt;</span>


<span class="tok-c1">// The parameters for our image processing pipeline</span>
<span class="tok-k">struct</span><span class="tok-w"> </span><span class="tok-nc">SobelParams</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">enum</span><span class="tok-w"> </span><span class="tok-k">class</span><span class="tok-w"> </span><span class="tok-nc">Orientation</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">Horizontal</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-n">Vertical</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">blur_size</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">1.25f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">deriv_order</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">1</span><span class="tok-p">;</span><span class="tok-w">  </span><span class="tok-c1">// order of the derivative</span>
<span class="tok-w">    </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">k_size</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">7</span><span class="tok-p">;</span><span class="tok-w">  </span><span class="tok-c1">// size of the extended Sobel kernel it must be 1, 3, 5, or 7 (or -1 for Scharr)</span>
<span class="tok-w">    </span><span class="tok-n">Orientation</span><span class="tok-w"> </span><span class="tok-n">orientation</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">Orientation</span><span class="tok-o">::</span><span class="tok-n">Vertical</span><span class="tok-p">;</span>
<span class="tok-p">};</span>


<span class="tok-c1">// Our image processing pipeline</span>
<span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Mat</span><span class="tok-w"> </span><span class="tok-nf">ComputeSobel</span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Mat</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">image</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">SobelParams</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Mat</span><span class="tok-w"> </span><span class="tok-n">gray</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">cvtColor</span><span class="tok-p">(</span><span class="tok-n">image</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">gray</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">COLOR_BGR2GRAY</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Mat</span><span class="tok-w"> </span><span class="tok-n">img_float</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">gray</span><span class="tok-p">.</span><span class="tok-n">convertTo</span><span class="tok-p">(</span><span class="tok-n">img_float</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">CV_32F</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">1.0</span><span class="tok-w"> </span><span class="tok-o">/</span><span class="tok-w"> </span><span class="tok-mf">255.0</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Mat</span><span class="tok-w"> </span><span class="tok-n">blurred</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">GaussianBlur</span><span class="tok-p">(</span><span class="tok-n">img_float</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">blurred</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Size</span><span class="tok-p">(),</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">blur_size</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">blur_size</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-kt">double</span><span class="tok-w"> </span><span class="tok-n">good_scale</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">1.0</span><span class="tok-w"> </span><span class="tok-o">/</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">pow</span><span class="tok-p">(</span><span class="tok-mf">2.0</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">k_size</span><span class="tok-w"> </span><span class="tok-o">-</span><span class="tok-w"> </span><span class="tok-mi">2</span><span class="tok-w"> </span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">deriv_order</span><span class="tok-w"> </span><span class="tok-o">-</span><span class="tok-w"> </span><span class="tok-mi">2</span><span class="tok-p">));</span>

<span class="tok-w">    </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">dx</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">dy</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">orientation</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">SobelParams</span><span class="tok-o">::</span><span class="tok-n">Orientation</span><span class="tok-o">::</span><span class="tok-n">Vertical</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">dx</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">deriv_order</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">dy</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-k">else</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">dx</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">dy</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">deriv_order</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Mat</span><span class="tok-w"> </span><span class="tok-n">r</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Sobel</span><span class="tok-p">(</span><span class="tok-n">blurred</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">r</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">CV_64F</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">dx</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">dy</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">k_size</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">good_scale</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">r</span><span class="tok-p">;</span>
<span class="tok-p">}</span>


<span class="tok-c1">// A GUI to edit the parameters for our image processing pipeline</span>
<span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-nf">GuiSobelParams</span><span class="tok-p">(</span><span class="tok-n">SobelParams</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">)</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// Blur size</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetNextItemWidth</span><span class="tok-p">(</span><span class="tok-n">ImmApp</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-mi">10</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SliderFloat</span><span class="tok-p">(</span><span class="tok-s">&quot;Blur size&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">blur_size</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.5f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">10.0f</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot; | &quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-c1">// Deriv order</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Deriv order&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">deriv_order</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">1</span><span class="tok-p">;</span><span class="tok-w"> </span><span class="tok-n">deriv_order</span><span class="tok-w"> </span><span class="tok-o">&lt;=</span><span class="tok-w"> </span><span class="tok-mi">4</span><span class="tok-p">;</span><span class="tok-w"> </span><span class="tok-o">++</span><span class="tok-n">deriv_order</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">RadioButton</span><span class="tok-p">(</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">to_string</span><span class="tok-p">(</span><span class="tok-n">deriv_order</span><span class="tok-p">).</span><span class="tok-n">c_str</span><span class="tok-p">(),</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">deriv_order</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">deriv_order</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">deriv_order</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">deriv_order</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot; | &quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Orientation&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">RadioButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Horizontal&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">orientation</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">SobelParams</span><span class="tok-o">::</span><span class="tok-n">Orientation</span><span class="tok-o">::</span><span class="tok-n">Horizontal</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">orientation</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">SobelParams</span><span class="tok-o">::</span><span class="tok-n">Orientation</span><span class="tok-o">::</span><span class="tok-n">Horizontal</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">RadioButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Vertical&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">orientation</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">SobelParams</span><span class="tok-o">::</span><span class="tok-n">Orientation</span><span class="tok-o">::</span><span class="tok-n">Vertical</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">params</span><span class="tok-p">.</span><span class="tok-n">orientation</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">SobelParams</span><span class="tok-o">::</span><span class="tok-n">Orientation</span><span class="tok-o">::</span><span class="tok-n">Vertical</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">changed</span><span class="tok-p">;</span>
<span class="tok-p">}</span>


<span class="tok-c1">// Our Application State contains:</span>
<span class="tok-c1">//     - the original &amp; processed image (image &amp; imageSobel)</span>
<span class="tok-c1">//     - our parameters for the processing pipeline (sobelParams)</span>
<span class="tok-c1">//     - parameters to display the images via ImmVision: they share the same zoom key,</span>
<span class="tok-c1">//       so that we can move the two image in sync</span>
<span class="tok-k">struct</span><span class="tok-w"> </span><span class="tok-nc">AppStateProcess</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Mat</span><span class="tok-w"> </span><span class="tok-n">image</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Mat</span><span class="tok-w"> </span><span class="tok-n">imageSobel</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">SobelParams</span><span class="tok-w"> </span><span class="tok-n">sobelParams</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">ImmVision</span><span class="tok-o">::</span><span class="tok-n">ImageParams</span><span class="tok-w"> </span><span class="tok-n">immvisionParams</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImmVision</span><span class="tok-o">::</span><span class="tok-n">ImageParams</span><span class="tok-w"> </span><span class="tok-n">immvisionParamsSobel</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">AppStateProcess</span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">image_file</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">ImmVision</span><span class="tok-o">::</span><span class="tok-n">UseBgrColorOrder</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">image</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">imread</span><span class="tok-p">(</span><span class="tok-n">image_file</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">sobelParams</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">SobelParams</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">imageSobel</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ComputeSobel</span><span class="tok-p">(</span><span class="tok-n">image</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">sobelParams</span><span class="tok-p">);</span>

<span class="tok-w">        </span><span class="tok-n">immvisionParams</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImmVision</span><span class="tok-o">::</span><span class="tok-n">ImageParams</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">immvisionParams</span><span class="tok-p">.</span><span class="tok-n">ImageDisplaySize</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Size</span><span class="tok-p">(</span><span class="tok-kt">int</span><span class="tok-p">(</span><span class="tok-n">ImmApp</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">(</span><span class="tok-mf">22.f</span><span class="tok-p">)),</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">immvisionParams</span><span class="tok-p">.</span><span class="tok-n">ZoomKey</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;z&quot;</span><span class="tok-p">;</span>

<span class="tok-w">        </span><span class="tok-n">immvisionParamsSobel</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImmVision</span><span class="tok-o">::</span><span class="tok-n">ImageParams</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">immvisionParamsSobel</span><span class="tok-p">.</span><span class="tok-n">ImageDisplaySize</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">cv</span><span class="tok-o">::</span><span class="tok-n">Size</span><span class="tok-p">(</span><span class="tok-kt">int</span><span class="tok-p">(</span><span class="tok-n">ImmApp</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">(</span><span class="tok-mf">22.f</span><span class="tok-p">)),</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">immvisionParamsSobel</span><span class="tok-p">.</span><span class="tok-n">ZoomKey</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;z&quot;</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">immvisionParamsSobel</span><span class="tok-p">.</span><span class="tok-n">ShowOptionsPanel</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-p">};</span>


<span class="tok-c1">// Our GUI function</span>
<span class="tok-c1">//     (which instantiates a static app state at startup)</span>
<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">demo_immvision_process</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">AppStateProcess</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">(</span><span class="tok-n">DemosAssetsFolder</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">+</span><span class="tok-w"> </span><span class="tok-s">&quot;/images/house.jpg&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        This example shows a example of image processing (sobel filter) where you can adjust the params and see their effect in real time.</span>

<span class="tok-s">        * Pan and zoom the image with the mouse and the mouse wheel</span>
<span class="tok-s">        * Apply Colormaps to the filtered image in the options tab.</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">GuiSobelParams</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">sobelParams</span><span class="tok-p">))</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">imageSobel</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ComputeSobel</span><span class="tok-p">(</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">image</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">sobelParams</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">immvisionParamsSobel</span><span class="tok-p">.</span><span class="tok-n">RefreshImage</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImmVision</span><span class="tok-o">::</span><span class="tok-n">Image</span><span class="tok-p">(</span><span class="tok-s">&quot;Original&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">image</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">immvisionParams</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImmVision</span><span class="tok-o">::</span><span class="tok-n">Image</span><span class="tok-p">(</span><span class="tok-s">&quot;Deriv&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">imageSobel</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">appState</span><span class="tok-p">.</span><span class="tok-n">immvisionParamsSobel</span><span class="tok-p">);</span>
<span class="tok-p">}</span>


<span class="tok-c1">// The main function is not present in this file, but it could be written as</span>
<span class="tok-c1">//        ImmApp::RunWithMarkdown(demo_immvision_process, &quot;demo_immvision_process&quot;);</span></code></pre>
</div>
</div>
</div>
</details>
<details>
<summary class="title">Click to see its source code in Python</summary>
<div class="content">
<div class="paragraph">
<p>Python:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="python"><span></span><span class="tok-kn">import</span> <span class="tok-nn">numpy</span> <span class="tok-k">as</span> <span class="tok-nn">np</span>
<span class="tok-kn">from</span> <span class="tok-nn">typing</span> <span class="tok-kn">import</span> <span class="tok-n">Any</span>
<span class="tok-kn">from</span> <span class="tok-nn">numpy.typing</span> <span class="tok-kn">import</span> <span class="tok-n">NDArray</span>
<span class="tok-kn">from</span> <span class="tok-nn">enum</span> <span class="tok-kn">import</span> <span class="tok-n">Enum</span>
<span class="tok-kn">import</span> <span class="tok-nn">cv2</span>  <span class="tok-c1"># type: ignore</span>
<span class="tok-kn">import</span> <span class="tok-nn">math</span>

<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">imgui</span><span class="tok-p">,</span> <span class="tok-n">immvision</span><span class="tok-p">,</span> <span class="tok-n">immapp</span><span class="tok-p">,</span> <span class="tok-n">imgui_md</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle.demos_python</span> <span class="tok-kn">import</span> <span class="tok-n">demo_utils</span>

<span class="tok-n">immvision</span><span class="tok-o">.</span><span class="tok-n">use_rgb_color_order</span><span class="tok-p">()</span>

<span class="tok-n">ImageRgb</span> <span class="tok-o">=</span> <span class="tok-n">NDArray</span><span class="tok-p">[</span><span class="tok-n">np</span><span class="tok-o">.</span><span class="tok-n">uint8</span><span class="tok-p">]</span>
<span class="tok-n">ImageFloat</span> <span class="tok-o">=</span> <span class="tok-n">NDArray</span><span class="tok-p">[</span><span class="tok-n">np</span><span class="tok-o">.</span><span class="tok-n">floating</span><span class="tok-p">[</span><span class="tok-n">Any</span><span class="tok-p">]]</span>


<span class="tok-k">class</span> <span class="tok-nc">SobelParams</span><span class="tok-p">:</span>
<span class="tok-w">    </span><span class="tok-sd">&quot;&quot;&quot;The parameters for our image processing pipeline&quot;&quot;&quot;</span>

    <span class="tok-k">class</span> <span class="tok-nc">Orientation</span><span class="tok-p">(</span><span class="tok-n">Enum</span><span class="tok-p">):</span>
        <span class="tok-n">Horizontal</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>
        <span class="tok-n">Vertical</span> <span class="tok-o">=</span> <span class="tok-mi">1</span>

    <span class="tok-n">blur_size</span> <span class="tok-o">=</span> <span class="tok-mf">1.25</span>
    <span class="tok-n">deriv_order</span> <span class="tok-o">=</span> <span class="tok-mi">1</span>  <span class="tok-c1"># order of the derivative</span>
    <span class="tok-n">k_size</span> <span class="tok-o">=</span> <span class="tok-mi">7</span>  <span class="tok-c1"># size of the extended Sobel kernel it must be 1, 3, 5, or 7 (or -1 for Scharr)</span>
    <span class="tok-n">orientation</span><span class="tok-p">:</span> <span class="tok-n">Orientation</span> <span class="tok-o">=</span> <span class="tok-n">Orientation</span><span class="tok-o">.</span><span class="tok-n">Vertical</span>


<span class="tok-k">def</span> <span class="tok-nf">compute_sobel</span><span class="tok-p">(</span><span class="tok-n">image</span><span class="tok-p">:</span> <span class="tok-n">ImageRgb</span><span class="tok-p">,</span> <span class="tok-n">params</span><span class="tok-p">:</span> <span class="tok-n">SobelParams</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-n">ImageFloat</span><span class="tok-p">:</span>
<span class="tok-w">    </span><span class="tok-sd">&quot;&quot;&quot;Our image processing pipeline&quot;&quot;&quot;</span>
    <span class="tok-n">gray</span> <span class="tok-o">=</span> <span class="tok-n">cv2</span><span class="tok-o">.</span><span class="tok-n">cvtColor</span><span class="tok-p">(</span><span class="tok-n">image</span><span class="tok-p">,</span> <span class="tok-n">cv2</span><span class="tok-o">.</span><span class="tok-n">COLOR_BGR2GRAY</span><span class="tok-p">)</span>
    <span class="tok-n">img_float</span> <span class="tok-o">=</span> <span class="tok-n">gray</span> <span class="tok-o">/</span> <span class="tok-mf">255.0</span>
    <span class="tok-n">blurred</span> <span class="tok-o">=</span> <span class="tok-n">cv2</span><span class="tok-o">.</span><span class="tok-n">GaussianBlur</span><span class="tok-p">(</span>
        <span class="tok-n">img_float</span><span class="tok-p">,</span> <span class="tok-p">(</span><span class="tok-mi">0</span><span class="tok-p">,</span> <span class="tok-mi">0</span><span class="tok-p">),</span> <span class="tok-n">sigmaX</span><span class="tok-o">=</span><span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">blur_size</span><span class="tok-p">,</span> <span class="tok-n">sigmaY</span><span class="tok-o">=</span><span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">blur_size</span>
    <span class="tok-p">)</span>

    <span class="tok-n">good_scale</span> <span class="tok-o">=</span> <span class="tok-mf">1.0</span> <span class="tok-o">/</span> <span class="tok-n">math</span><span class="tok-o">.</span><span class="tok-n">pow</span><span class="tok-p">(</span><span class="tok-mf">2.0</span><span class="tok-p">,</span> <span class="tok-p">(</span><span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">k_size</span> <span class="tok-o">-</span> <span class="tok-mi">2</span> <span class="tok-o">*</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">deriv_order</span> <span class="tok-o">-</span> <span class="tok-mi">2</span><span class="tok-p">))</span>

    <span class="tok-k">if</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">orientation</span> <span class="tok-o">==</span> <span class="tok-n">SobelParams</span><span class="tok-o">.</span><span class="tok-n">Orientation</span><span class="tok-o">.</span><span class="tok-n">Vertical</span><span class="tok-p">:</span>
        <span class="tok-n">dx</span> <span class="tok-o">=</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">deriv_order</span>
        <span class="tok-n">dy</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>
    <span class="tok-k">else</span><span class="tok-p">:</span>
        <span class="tok-n">dx</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>
        <span class="tok-n">dy</span> <span class="tok-o">=</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">deriv_order</span>
    <span class="tok-n">r</span> <span class="tok-o">=</span> <span class="tok-n">cv2</span><span class="tok-o">.</span><span class="tok-n">Sobel</span><span class="tok-p">(</span>
        <span class="tok-n">blurred</span><span class="tok-p">,</span> <span class="tok-n">ddepth</span><span class="tok-o">=</span><span class="tok-n">cv2</span><span class="tok-o">.</span><span class="tok-n">CV_64F</span><span class="tok-p">,</span> <span class="tok-n">dx</span><span class="tok-o">=</span><span class="tok-n">dx</span><span class="tok-p">,</span> <span class="tok-n">dy</span><span class="tok-o">=</span><span class="tok-n">dy</span><span class="tok-p">,</span> <span class="tok-n">ksize</span><span class="tok-o">=</span><span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">k_size</span><span class="tok-p">,</span> <span class="tok-n">scale</span><span class="tok-o">=</span><span class="tok-n">good_scale</span>
    <span class="tok-p">)</span>
    <span class="tok-k">return</span> <span class="tok-n">r</span>  <span class="tok-c1"># type: ignore</span>


<span class="tok-k">def</span> <span class="tok-nf">gui_sobel_params</span><span class="tok-p">(</span><span class="tok-n">params</span><span class="tok-p">:</span> <span class="tok-n">SobelParams</span><span class="tok-p">)</span> <span class="tok-o">-&gt;</span> <span class="tok-nb">bool</span><span class="tok-p">:</span>
<span class="tok-w">    </span><span class="tok-sd">&quot;&quot;&quot;A GUI to edit the parameters for our image processing pipeline&quot;&quot;&quot;</span>
    <span class="tok-n">changed</span> <span class="tok-o">=</span> <span class="tok-kc">False</span>

    <span class="tok-c1"># Blur size</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_next_item_width</span><span class="tok-p">(</span><span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">()</span> <span class="tok-o">*</span> <span class="tok-mi">10</span><span class="tok-p">)</span>
    <span class="tok-n">c</span><span class="tok-p">,</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">blur_size</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">slider_float</span><span class="tok-p">(</span><span class="tok-s2">&quot;Blur size&quot;</span><span class="tok-p">,</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">blur_size</span><span class="tok-p">,</span> <span class="tok-mf">0.5</span><span class="tok-p">,</span> <span class="tok-mi">10</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">c</span><span class="tok-p">:</span>
        <span class="tok-n">changed</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot; | &quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-c1"># Deriv order</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Deriv order&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">for</span> <span class="tok-n">deriv_order</span> <span class="tok-ow">in</span> <span class="tok-p">(</span><span class="tok-mi">1</span><span class="tok-p">,</span> <span class="tok-mi">2</span><span class="tok-p">,</span> <span class="tok-mi">3</span><span class="tok-p">,</span> <span class="tok-mi">4</span><span class="tok-p">):</span>
        <span class="tok-n">c</span><span class="tok-p">,</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">deriv_order</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">radio_button</span><span class="tok-p">(</span>
            <span class="tok-nb">str</span><span class="tok-p">(</span><span class="tok-n">deriv_order</span><span class="tok-p">),</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">deriv_order</span><span class="tok-p">,</span> <span class="tok-n">deriv_order</span>
        <span class="tok-p">)</span>
        <span class="tok-k">if</span> <span class="tok-n">c</span><span class="tok-p">:</span>
            <span class="tok-n">changed</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot; | &quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Orientation&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">radio_button</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;Horizontal&quot;</span><span class="tok-p">,</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">orientation</span> <span class="tok-o">==</span> <span class="tok-n">SobelParams</span><span class="tok-o">.</span><span class="tok-n">Orientation</span><span class="tok-o">.</span><span class="tok-n">Horizontal</span>
    <span class="tok-p">):</span>
        <span class="tok-n">changed</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
        <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">orientation</span> <span class="tok-o">=</span> <span class="tok-n">SobelParams</span><span class="tok-o">.</span><span class="tok-n">Orientation</span><span class="tok-o">.</span><span class="tok-n">Horizontal</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">radio_button</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;Vertical&quot;</span><span class="tok-p">,</span> <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">orientation</span> <span class="tok-o">==</span> <span class="tok-n">SobelParams</span><span class="tok-o">.</span><span class="tok-n">Orientation</span><span class="tok-o">.</span><span class="tok-n">Vertical</span>
    <span class="tok-p">):</span>
        <span class="tok-n">changed</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>
        <span class="tok-n">params</span><span class="tok-o">.</span><span class="tok-n">orientation</span> <span class="tok-o">=</span> <span class="tok-n">SobelParams</span><span class="tok-o">.</span><span class="tok-n">Orientation</span><span class="tok-o">.</span><span class="tok-n">Vertical</span>

    <span class="tok-k">return</span> <span class="tok-n">changed</span>


<span class="tok-c1"># Our Application State contains:</span>
<span class="tok-c1">#     - the original &amp; processed image (image &amp; imageSobel)</span>
<span class="tok-c1">#     - our parameters for the processing pipeline (sobelParams)</span>
<span class="tok-c1">#     - parameters to display the images via ImmVision: they share the same zoom key,</span>
<span class="tok-c1">#       so that we can move the two image in sync</span>
<span class="tok-k">class</span> <span class="tok-nc">AppState</span><span class="tok-p">:</span>
    <span class="tok-n">image</span><span class="tok-p">:</span> <span class="tok-n">ImageRgb</span>
    <span class="tok-n">image_sobel</span><span class="tok-p">:</span> <span class="tok-n">ImageFloat</span>
    <span class="tok-n">sobel_params</span><span class="tok-p">:</span> <span class="tok-n">SobelParams</span>

    <span class="tok-n">immvision_params</span><span class="tok-p">:</span> <span class="tok-n">immvision</span><span class="tok-o">.</span><span class="tok-n">ImageParams</span>
    <span class="tok-n">immvision_params_sobel</span><span class="tok-p">:</span> <span class="tok-n">immvision</span><span class="tok-o">.</span><span class="tok-n">ImageParams</span>

    <span class="tok-k">def</span> <span class="tok-fm">__init__</span><span class="tok-p">(</span><span class="tok-bp">self</span><span class="tok-p">,</span> <span class="tok-n">image_file</span><span class="tok-p">:</span> <span class="tok-nb">str</span><span class="tok-p">):</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">image</span> <span class="tok-o">=</span> <span class="tok-n">demo_utils</span><span class="tok-o">.</span><span class="tok-n">imread_demo</span><span class="tok-p">(</span><span class="tok-n">image_file</span><span class="tok-p">)</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">sobel_params</span> <span class="tok-o">=</span> <span class="tok-n">SobelParams</span><span class="tok-p">()</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">image_sobel</span> <span class="tok-o">=</span> <span class="tok-n">compute_sobel</span><span class="tok-p">(</span><span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">image</span><span class="tok-p">,</span> <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">sobel_params</span><span class="tok-p">)</span>

        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">immvision_params</span> <span class="tok-o">=</span> <span class="tok-n">immvision</span><span class="tok-o">.</span><span class="tok-n">ImageParams</span><span class="tok-p">()</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">immvision_params</span><span class="tok-o">.</span><span class="tok-n">image_display_size</span> <span class="tok-o">=</span> <span class="tok-p">(</span><span class="tok-nb">int</span><span class="tok-p">(</span><span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">(</span><span class="tok-mi">22</span><span class="tok-p">)),</span> <span class="tok-mi">0</span><span class="tok-p">)</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">immvision_params</span><span class="tok-o">.</span><span class="tok-n">zoom_key</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;z&quot;</span>

        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">immvision_params_sobel</span> <span class="tok-o">=</span> <span class="tok-n">immvision</span><span class="tok-o">.</span><span class="tok-n">ImageParams</span><span class="tok-p">()</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">immvision_params_sobel</span><span class="tok-o">.</span><span class="tok-n">image_display_size</span> <span class="tok-o">=</span> <span class="tok-p">(</span><span class="tok-nb">int</span><span class="tok-p">(</span><span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">(</span><span class="tok-mi">22</span><span class="tok-p">)),</span> <span class="tok-mi">0</span><span class="tok-p">)</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">immvision_params_sobel</span><span class="tok-o">.</span><span class="tok-n">zoom_key</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;z&quot;</span>
        <span class="tok-bp">self</span><span class="tok-o">.</span><span class="tok-n">immvision_params_sobel</span><span class="tok-o">.</span><span class="tok-n">show_options_panel</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>


<span class="tok-c1"># Our GUI function</span>
<span class="tok-c1">#    (which instantiates a static app state at startup)</span>
<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span><span class="tok-n">app_state</span><span class="tok-o">=</span><span class="tok-kc">None</span><span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_gui</span><span class="tok-p">():</span>
    <span class="tok-n">static</span> <span class="tok-o">=</span> <span class="tok-n">demo_gui</span>

    <span class="tok-k">if</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span> <span class="tok-ow">is</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span> <span class="tok-o">=</span> <span class="tok-n">AppState</span><span class="tok-p">(</span><span class="tok-n">demo_utils</span><span class="tok-o">.</span><span class="tok-n">demos_assets_folder</span><span class="tok-p">()</span> <span class="tok-o">+</span> <span class="tok-s2">&quot;/images/house.jpg&quot;</span><span class="tok-p">)</span>

    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render_unindented</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">        This example shows a example of image processing (sobel filter) where you can adjust the params and see their effect in real time.</span>

<span class="tok-sd">        * Pan and zoom the image with the mouse and the mouse wheel</span>
<span class="tok-sd">        * Apply Colormaps to the filtered image in the options tab.</span>
<span class="tok-sd">        &quot;&quot;&quot;</span>
    <span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>

    <span class="tok-n">changed</span> <span class="tok-o">=</span> <span class="tok-n">gui_sobel_params</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">sobel_params</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">changed</span><span class="tok-p">:</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">image_sobel</span> <span class="tok-o">=</span> <span class="tok-n">compute_sobel</span><span class="tok-p">(</span>
            <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">image</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">sobel_params</span>
        <span class="tok-p">)</span>
    <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">immvision_params_sobel</span><span class="tok-o">.</span><span class="tok-n">refresh_image</span> <span class="tok-o">=</span> <span class="tok-n">changed</span>

    <span class="tok-n">immvision</span><span class="tok-o">.</span><span class="tok-n">image</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;Original&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">image</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">immvision_params</span>
    <span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">immvision</span><span class="tok-o">.</span><span class="tok-n">image</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;Deriv&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">image_sobel</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">app_state</span><span class="tok-o">.</span><span class="tok-n">immvision_params_sobel</span>
    <span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">main</span><span class="tok-p">():</span>
    <span class="tok-n">demo_utils</span><span class="tok-o">.</span><span class="tok-n">set_hello_imgui_demo_assets_folder</span><span class="tok-p">()</span>
    <span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">run_with_markdown</span><span class="tok-p">(</span><span class="tok-n">demo_gui</span><span class="tok-p">,</span> <span class="tok-n">window_size</span><span class="tok-o">=</span><span class="tok-p">(</span><span class="tok-mi">1000</span><span class="tok-p">,</span> <span class="tok-mi">1000</span><span class="tok-p">))</span>


<span class="tok-c1"># The main entry point will run our GUI function</span>
<span class="tok-k">if</span> <span class="tok-vm">__name__</span> <span class="tok-o">==</span> <span class="tok-s2">&quot;__main__&quot;</span><span class="tok-p">:</span>
    <span class="tok-n">main</span><span class="tok-p">()</span></code></pre>
</div>
</div>
</div>
</details>
</div>
<div class="sect2">
<h3 id="_widgets">Widgets</h3>
<div class="sect3">
<h4 id="_dear_imgui_widgets">Dear ImGui Widgets</h4>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_widgets_imgui.jpg" alt="demo widgets imgui" width="400">
</div>
<div class="title">Figure 10. Dear ImGui widgets</div>
</div>
<div class="paragraph">
<p><a href="https://github.com/ocornut/imgui">Dear ImGui</a> provides <em>lots</em> of widgets by default.</p>
</div>
<div class="paragraph">
<p><a href="https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html">ImGui Manual</a> enables you to browse all of them all, while looking at their code.</p>
</div>
<hr>
</div>
<div class="sect3">
<h4 id="_additional_widgets">Additional Widgets</h4>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_widgets_knobs.jpg" alt="demo widgets knobs" width="400">
</div>
<div class="title">Figure 11. Knobs widget</div>
</div>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_widgets_toggle.jpg" alt="demo widgets toggle" width="400">
</div>
<div class="title">Figure 12. Toggle widget</div>
</div>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_widgets_spinners.jpg" alt="demo widgets spinners" width="400">
</div>
<div class="title">Figure 13. Spinners widget</div>
</div>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_widgets_file_dialog.jpg" alt="demo widgets file dialog" width="400">
</div>
<div class="title">Figure 14. File dialog</div>
</div>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_widgets_coolbar.jpg" alt="demo widgets coolbar" width="400">
</div>
<div class="title">Figure 15. Cool bar</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_widgets.html">Try these widgets in your browser</a></p>
</div>
<details>
<summary class="title">Click to see the widgets code in C&#43;&#43;</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cpp"><span></span><span class="tok-c1">// Part of ImGui Bundle - MIT License - Copyright (c) 2022-2024 Pascal Thomet - https://github.com/pthom/imgui_bundle</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;hello_imgui/hello_imgui.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;hello_imgui/icons_font_awesome_4.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imspinner/imspinner.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_toggle/imgui_toggle.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_toggle/imgui_toggle_presets.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_toggle/imgui_toggle_palette.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_toggle/imgui_toggle_renderer.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;immapp/immapp.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;portable_file_dialogs/portable_file_dialogs.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui-command-palette/imcmd_command_palette.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui-knobs/imgui-knobs.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;ImGuiColorTextEdit/TextEditor.h&quot;</span>
<span class="tok-cp">#ifdef IMGUI_BUNDLE_WITH_IMFILEDIALOG</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;ImFileDialog/ImFileDialog.h&quot;</span>
<span class="tok-cp">#endif</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_md_wrapper.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;ImCoolBar/ImCoolBar.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;demo_utils/api_demos.h&quot;</span>

<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;fplus/fplus.hpp&gt;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;memory&gt;</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">DemoKnobs</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        # Knobs</span>
<span class="tok-s">        [imgui-knobs](https://github.com/altschuler/imgui-knobs) provides knobs for ImGui.</span>
<span class="tok-s">        </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">knob_float_value</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">knob_int_value</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">pair</span><span class="tok-o">&lt;</span><span class="tok-n">ImGuiKnobVariant</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&gt;&gt;</span><span class="tok-w"> </span><span class="tok-n">knob_types</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiKnobVariant_Tick</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;tick&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiKnobVariant_Dot</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;dot&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiKnobVariant_Space</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;space&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiKnobVariant_Stepped</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;stepped&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiKnobVariant_Wiper</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;wiper&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiKnobVariant_WiperDot</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;wiper_dot&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">ImGuiKnobVariant_WiperOnly</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;wiper_only&quot;</span><span class="tok-p">},</span>
<span class="tok-w">    </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">show_float_knobs</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">knob_types</span><span class="tok-p">](</span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">knob_size</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">knob_size_str</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">to_string</span><span class="tok-p">(</span><span class="tok-n">knob_size</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PushID</span><span class="tok-p">((</span><span class="tok-n">knob_size_str</span><span class="tok-w"> </span><span class="tok-o">+</span><span class="tok-w"> </span><span class="tok-s">&quot;_float&quot;</span><span class="tok-p">).</span><span class="tok-n">c_str</span><span class="tok-p">());</span>
<span class="tok-w">        </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-k">auto</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-n">knob_type</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">knob_typename</span><span class="tok-p">]</span><span class="tok-w"> </span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-n">knob_types</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">ImGuiKnobs</span><span class="tok-o">::</span><span class="tok-n">Knob</span><span class="tok-p">(</span>
<span class="tok-w">                </span><span class="tok-n">knob_typename</span><span class="tok-p">.</span><span class="tok-n">c_str</span><span class="tok-p">(),</span>
<span class="tok-w">                </span><span class="tok-o">&amp;</span><span class="tok-n">knob_float_value</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*v_min=*/</span><span class="tok-w">   </span><span class="tok-mf">0.0f</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*v_max=*/</span><span class="tok-w">   </span><span class="tok-mf">1.0f</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*speed=*/</span><span class="tok-w">   </span><span class="tok-mi">0</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*format=*/</span><span class="tok-w">  </span><span class="tok-s">&quot;%.2f&quot;</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*variant=*/</span><span class="tok-w"> </span><span class="tok-n">knob_type</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*size=*/</span><span class="tok-w">    </span><span class="tok-n">knob_size</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*flags=*/</span><span class="tok-w">   </span><span class="tok-mi">0</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*steps=*/</span><span class="tok-w">   </span><span class="tok-mi">100</span>
<span class="tok-w">            </span><span class="tok-p">);</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopID</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">};</span>


<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">show_int_knobs</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-n">knob_types</span><span class="tok-p">](</span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">knob_size</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">knob_size_str</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">to_string</span><span class="tok-p">(</span><span class="tok-n">knob_size</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PushID</span><span class="tok-p">((</span><span class="tok-n">knob_size_str</span><span class="tok-w"> </span><span class="tok-o">+</span><span class="tok-w"> </span><span class="tok-s">&quot;_int&quot;</span><span class="tok-p">).</span><span class="tok-n">c_str</span><span class="tok-p">());</span>
<span class="tok-w">        </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-k">auto</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-n">knob_type</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">knob_typename</span><span class="tok-p">]</span><span class="tok-w"> </span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-n">knob_types</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">ImGuiKnobs</span><span class="tok-o">::</span><span class="tok-n">KnobInt</span><span class="tok-p">(</span>
<span class="tok-w">                </span><span class="tok-n">knob_typename</span><span class="tok-p">.</span><span class="tok-n">c_str</span><span class="tok-p">(),</span>
<span class="tok-w">                </span><span class="tok-o">&amp;</span><span class="tok-n">knob_int_value</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*v_min=*/</span><span class="tok-w">   </span><span class="tok-mf">0.0</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*v_max=*/</span><span class="tok-w">   </span><span class="tok-mi">15</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*speed=*/</span><span class="tok-w">   </span><span class="tok-mi">0</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*format=*/</span><span class="tok-w">  </span><span class="tok-s">&quot;%02i&quot;</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*variant=*/</span><span class="tok-w"> </span><span class="tok-n">knob_type</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*size=*/</span><span class="tok-w">    </span><span class="tok-n">knob_size</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*flags=*/</span><span class="tok-w">   </span><span class="tok-mi">0</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-cm">/*steps=*/</span><span class="tok-w">   </span><span class="tok-mi">10</span>
<span class="tok-w">            </span><span class="tok-p">);</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopID</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">knobsSizeSmall</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImmApp</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-mf">2.5</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">knobsSizeBig</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">knobsSizeSmall</span><span class="tok-w"> </span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-mf">1.3</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Some small knobs&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">show_float_knobs</span><span class="tok-p">(</span><span class="tok-n">knobsSizeSmall</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndGroup</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginGroup</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Some big knobs (int values)&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">show_int_knobs</span><span class="tok-p">(</span><span class="tok-n">knobsSizeBig</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndGroup</span><span class="tok-p">();</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">DemoSpinner</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        # Spinners</span>
<span class="tok-s">        [imspinner](https://github.com/dalerank/imspinner) provides spinners for ImGui.</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImColor</span><span class="tok-w"> </span><span class="tok-n">color</span><span class="tok-p">(</span><span class="tok-mf">0.3f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.5f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.9f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">1.f</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;spinner_moving_dots&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImSpinner</span><span class="tok-o">::</span><span class="tok-n">SpinnerMovingDots</span><span class="tok-p">(</span><span class="tok-s">&quot;spinner_moving_dots&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">20.0</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">4.0</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">color</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mi">20</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">radius</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetFontSize</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">/</span><span class="tok-w"> </span><span class="tok-mf">1.8f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;spinner_arc_rotation&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImSpinner</span><span class="tok-o">::</span><span class="tok-n">SpinnerArcRotation</span><span class="tok-p">(</span><span class="tok-s">&quot;spinner_arc_rotation&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">radius</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">4.0</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">color</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">radius1</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetFontSize</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">/</span><span class="tok-w"> </span><span class="tok-mf">2.5f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;spinner_ang_triple&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImSpinner</span><span class="tok-o">::</span><span class="tok-n">SpinnerAngTriple</span><span class="tok-p">(</span><span class="tok-s">&quot;spinner_ang_triple&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">radius1</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">radius1</span><span class="tok-w"> </span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-mf">1.5f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">radius1</span><span class="tok-w"> </span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-mf">2.0f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">2.5f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">color</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">color</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">color</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">show_full_demo</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Checkbox</span><span class="tok-p">(</span><span class="tok-s">&quot;Show full spinners demo&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">show_full_demo</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">show_full_demo</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-n">ImSpinner</span><span class="tok-o">::</span><span class="tok-n">demoSpinners</span><span class="tok-p">();</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">DemoToggle</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">flag</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        # Toggle Switch</span>
<span class="tok-s">        [imgui_toggle](https://github.com/cmdwtf/imgui_toggle) provides toggle switches for ImGui.&quot;&quot;&quot;</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">|=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Toggle</span><span class="tok-p">(</span><span class="tok-s">&quot;Default Toggle&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">flag</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">|=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Toggle</span><span class="tok-p">(</span><span class="tok-s">&quot;Animated Toggle&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">flag</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImGuiToggleFlags_Animated</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">toggle_config</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiTogglePresets</span><span class="tok-o">::</span><span class="tok-n">MaterialStyle</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">toggle_config</span><span class="tok-p">.</span><span class="tok-n">AnimationDuration</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mf">0.4f</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">|=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Toggle</span><span class="tok-p">(</span><span class="tok-s">&quot;Material Style (with slowed anim)&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">flag</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">toggle_config</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">|=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Toggle</span><span class="tok-p">(</span><span class="tok-s">&quot;iOS style&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">flag</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImGuiTogglePresets</span><span class="tok-o">::</span><span class="tok-n">iOSStyle</span><span class="tok-p">(</span><span class="tok-mf">0.2f</span><span class="tok-p">));</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">changed</span><span class="tok-w"> </span><span class="tok-o">|=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Toggle</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-s">&quot;iOS style (light)&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">flag</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImGuiTogglePresets</span><span class="tok-o">::</span><span class="tok-n">iOSStyle</span><span class="tok-p">(</span><span class="tok-mf">0.2f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">));</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">DemoPortableFileDialogs</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">lastFileSelection</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PushID</span><span class="tok-p">(</span><span class="tok-s">&quot;pfd&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        # Portable File Dialogs</span>
<span class="tok-s">        [portable-file-dialogs](https://github.com/samhocevar/portable-file-dialogs) provides file dialogs</span>
<span class="tok-s">        as well as notifications and messages. They will use the native dialogs and notifications on each platform.</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>

<span class="tok-cp">#ifdef __EMSCRIPTEN__</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        *Note: On Emscripten/Web, only messages dialogs (with an Ok button and an icon) are supported.</span>
<span class="tok-s">        On Windows, Linux and MacOS, everything is supported.*</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>
<span class="tok-cp">#endif</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;      ---   File dialogs   ---&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">logResult</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">what</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">lastFileSelection</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">what</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">logResultList</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&gt;&amp;</span><span class="tok-w"> </span><span class="tok-n">whats</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">lastFileSelection</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">fplus</span><span class="tok-o">::</span><span class="tok-n">join</span><span class="tok-p">(</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-p">(</span><span class="tok-s">&quot;</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span><span class="tok-p">),</span><span class="tok-w"> </span><span class="tok-n">whats</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">unique_ptr</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">open_file</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">openFileDialog</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Open File&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">openFileDialog</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">make_unique</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">open_file</span><span class="tok-o">&gt;</span><span class="tok-p">(</span><span class="tok-s">&quot;Select file&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">openFileDialog</span><span class="tok-p">.</span><span class="tok-n">get</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">openFileDialog</span><span class="tok-o">-&gt;</span><span class="tok-n">ready</span><span class="tok-p">())</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">logResultList</span><span class="tok-p">(</span><span class="tok-n">openFileDialog</span><span class="tok-o">-&gt;</span><span class="tok-n">result</span><span class="tok-p">());</span>
<span class="tok-w">        </span><span class="tok-n">openFileDialog</span><span class="tok-p">.</span><span class="tok-n">reset</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>


<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">unique_ptr</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">open_file</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">openFileMultiselect</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Open File (multiselect)&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">openFileMultiselect</span><span class="tok-p">.</span><span class="tok-n">reset</span><span class="tok-p">(</span><span class="tok-k">new</span><span class="tok-w"> </span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">open_file</span><span class="tok-p">(</span><span class="tok-s">&quot;Select file&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-p">{},</span><span class="tok-w"> </span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">opt</span><span class="tok-o">::</span><span class="tok-n">multiselect</span><span class="tok-p">));</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">openFileMultiselect</span><span class="tok-p">.</span><span class="tok-n">get</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">openFileMultiselect</span><span class="tok-o">-&gt;</span><span class="tok-n">ready</span><span class="tok-p">())</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">logResultList</span><span class="tok-p">(</span><span class="tok-n">openFileMultiselect</span><span class="tok-o">-&gt;</span><span class="tok-n">result</span><span class="tok-p">());</span>
<span class="tok-w">        </span><span class="tok-n">openFileMultiselect</span><span class="tok-p">.</span><span class="tok-n">reset</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">unique_ptr</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">save_file</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">saveFileDialog</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Save File&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">saveFileDialog</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">make_unique</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">save_file</span><span class="tok-o">&gt;</span><span class="tok-p">(</span><span class="tok-s">&quot;Save file&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">saveFileDialog</span><span class="tok-p">.</span><span class="tok-n">get</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">saveFileDialog</span><span class="tok-o">-&gt;</span><span class="tok-n">ready</span><span class="tok-p">())</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">logResult</span><span class="tok-p">(</span><span class="tok-n">saveFileDialog</span><span class="tok-o">-&gt;</span><span class="tok-n">result</span><span class="tok-p">());</span>
<span class="tok-w">        </span><span class="tok-n">saveFileDialog</span><span class="tok-p">.</span><span class="tok-n">reset</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">unique_ptr</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">select_folder</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">selectFolderDialog</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Select Folder&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">selectFolderDialog</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">make_unique</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">select_folder</span><span class="tok-o">&gt;</span><span class="tok-p">(</span><span class="tok-s">&quot;Select folder&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">selectFolderDialog</span><span class="tok-p">.</span><span class="tok-n">get</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">selectFolderDialog</span><span class="tok-o">-&gt;</span><span class="tok-n">ready</span><span class="tok-p">())</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">logResult</span><span class="tok-p">(</span><span class="tok-n">selectFolderDialog</span><span class="tok-o">-&gt;</span><span class="tok-n">result</span><span class="tok-p">());</span>
<span class="tok-w">        </span><span class="tok-n">selectFolderDialog</span><span class="tok-p">.</span><span class="tok-n">reset</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">lastFileSelection</span><span class="tok-p">.</span><span class="tok-n">size</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;%s&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">lastFileSelection</span><span class="tok-p">.</span><span class="tok-n">c_str</span><span class="tok-p">());</span>


<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;      ---   Notifications and messages   ---&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">icon</span><span class="tok-w"> </span><span class="tok-n">iconType</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">icon</span><span class="tok-o">::</span><span class="tok-n">info</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">optional</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">message</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">messageDialog</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">choice</span><span class="tok-w"> </span><span class="tok-n">messageChoiceType</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">choice</span><span class="tok-o">::</span><span class="tok-n">ok</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-c1">// icon type</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Icon type&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">pair</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">icon</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-kt">char</span><span class="tok-o">*&gt;&gt;</span><span class="tok-w"> </span><span class="tok-n">iconTypes</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">icon</span><span class="tok-o">::</span><span class="tok-n">info</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;info&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">icon</span><span class="tok-o">::</span><span class="tok-n">warning</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;warning&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">icon</span><span class="tok-o">::</span><span class="tok-n">error</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;error&quot;</span><span class="tok-p">},</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-k">auto</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-n">notification_icon</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">name</span><span class="tok-p">]</span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-n">iconTypes</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">RadioButton</span><span class="tok-p">(</span><span class="tok-n">name</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">iconType</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">notification_icon</span><span class="tok-p">))</span>
<span class="tok-w">            </span><span class="tok-n">iconType</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">notification_icon</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Add Notif&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">notify</span><span class="tok-p">(</span><span class="tok-s">&quot;Notification title&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;This is an example notification&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">iconType</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-c1">// messages</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-c1">// 1. Display the message</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Add message&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">messageDialog</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">message</span><span class="tok-p">(</span><span class="tok-s">&quot;Message title&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;This is an example message&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">messageChoiceType</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">iconType</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-c1">// 2. Handle the message result</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">messageDialog</span><span class="tok-p">.</span><span class="tok-n">has_value</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">messageDialog</span><span class="tok-o">-&gt;</span><span class="tok-n">ready</span><span class="tok-p">())</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">printf</span><span class="tok-p">(</span><span class="tok-s">&quot;msg ready</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-c1">// Get the result via messageDialog-&gt;result()</span>
<span class="tok-w">        </span><span class="tok-n">messageDialog</span><span class="tok-p">.</span><span class="tok-n">reset</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-c1">// Optional: Select the message type</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">pair</span><span class="tok-o">&lt;</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">choice</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-kt">char</span><span class="tok-o">*&gt;&gt;</span><span class="tok-w"> </span><span class="tok-n">choiceTypes</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">choice</span><span class="tok-o">::</span><span class="tok-n">ok</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;ok&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">choice</span><span class="tok-o">::</span><span class="tok-n">yes_no</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;yes_no&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">choice</span><span class="tok-o">::</span><span class="tok-n">yes_no_cancel</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;yes_no_cancel&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">choice</span><span class="tok-o">::</span><span class="tok-n">retry_cancel</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;retry_cancel&quot;</span><span class="tok-p">},</span>
<span class="tok-w">        </span><span class="tok-p">{</span><span class="tok-n">pfd</span><span class="tok-o">::</span><span class="tok-n">choice</span><span class="tok-o">::</span><span class="tok-n">abort_retry_ignore</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;abort_retry_ignore&quot;</span><span class="tok-p">},</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-k">auto</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-n">choice_type</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">name</span><span class="tok-p">]</span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-n">choiceTypes</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">RadioButton</span><span class="tok-p">(</span><span class="tok-n">name</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">messageChoiceType</span><span class="tok-w"> </span><span class="tok-o">==</span><span class="tok-w"> </span><span class="tok-n">choice_type</span><span class="tok-p">))</span>
<span class="tok-w">            </span><span class="tok-n">messageChoiceType</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">choice_type</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopID</span><span class="tok-p">();</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">DemoImFileDialog</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-cp">#ifdef IMGUI_BUNDLE_WITH_IMFILEDIALOG</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">selectedFilename</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        # ImFileDialog</span>
<span class="tok-s">         [ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui.</span>
<span class="tok-s">        </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-n">ICON_FA_EXCLAMATION_TRIANGLE</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SetItemTooltip</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-s">&quot;It is advised to use Portable File Dialogs instead, which offer native dialogs on each platform, &quot;</span>
<span class="tok-w">        </span><span class="tok-s">&quot;as well as notifications and messages.</span><span class="tok-se">\n\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">        </span><span class="tok-s">&quot;Known limitations of ImFileDialog:</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">        </span><span class="tok-s">&quot;  * Not adapted for High DPI resolution under windows</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">        </span><span class="tok-s">&quot;  * No support for multi-selection</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span>
<span class="tok-w">        </span><span class="tok-s">&quot;  * Will not work under python with a pure python backend (requires to use `immapp.run()`)&quot;</span>
<span class="tok-w">    </span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Open file&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">Open</span><span class="tok-p">(</span>
<span class="tok-w">            </span><span class="tok-s">&quot;ShaderOpenDialog&quot;</span><span class="tok-p">,</span>
<span class="tok-w">            </span><span class="tok-s">&quot;Open a shader&quot;</span><span class="tok-p">,</span>
<span class="tok-w">            </span><span class="tok-s">&quot;Image file (*.png*.jpg*.jpeg*.bmp*.tga).png,.jpg,.jpeg,.bmp,.tga,.*&quot;</span><span class="tok-p">,</span>
<span class="tok-w">            </span><span class="tok-nb">true</span>
<span class="tok-w">        </span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Open directory&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">Open</span><span class="tok-p">(</span><span class="tok-s">&quot;DirectoryOpenDialog&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Open a directory&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Save file&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">Save</span><span class="tok-p">(</span><span class="tok-s">&quot;ShaderSaveDialog&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;Save a shader&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;*.sprj .sprj&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">selectedFilename</span><span class="tok-p">.</span><span class="tok-n">size</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Last file selection:</span><span class="tok-se">\n</span><span class="tok-s">%s&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">selectedFilename</span><span class="tok-p">.</span><span class="tok-n">c_str</span><span class="tok-p">());</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">IsDone</span><span class="tok-p">(</span><span class="tok-s">&quot;ShaderOpenDialog&quot;</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">HasResult</span><span class="tok-p">())</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-c1">// get_results: plural form - ShaderOpenDialog supports multi-selection</span>
<span class="tok-w">            </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">results</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">GetResults</span><span class="tok-p">();</span>
<span class="tok-w">            </span><span class="tok-n">selectedFilename</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;&quot;</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">path</span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-n">results</span><span class="tok-p">)</span>
<span class="tok-w">                </span><span class="tok-n">selectedFilename</span><span class="tok-w"> </span><span class="tok-o">+=</span><span class="tok-w"> </span><span class="tok-n">path</span><span class="tok-p">.</span><span class="tok-n">string</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">+</span><span class="tok-w"> </span><span class="tok-s">&quot;</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">        </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">Close</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">IsDone</span><span class="tok-p">(</span><span class="tok-s">&quot;DirectoryOpenDialog&quot;</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">HasResult</span><span class="tok-p">())</span>
<span class="tok-w">            </span><span class="tok-n">selectedFilename</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">GetResult</span><span class="tok-p">().</span><span class="tok-n">string</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">Close</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">IsDone</span><span class="tok-p">(</span><span class="tok-s">&quot;ShaderSaveDialog&quot;</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">HasResult</span><span class="tok-p">())</span>
<span class="tok-w">            </span><span class="tok-n">selectedFilename</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">GetResult</span><span class="tok-p">().</span><span class="tok-n">string</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ifd</span><span class="tok-o">::</span><span class="tok-n">FileDialog</span><span class="tok-o">::</span><span class="tok-n">Instance</span><span class="tok-p">().</span><span class="tok-n">Close</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>
<span class="tok-cp">#endif </span><span class="tok-c1">// #ifdef IMGUI_BUNDLE_WITH_IMFILEDIALOG</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">DemoCommandPalette</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">wasInited</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">showCommandPalette</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">Context</span><span class="tok-w"> </span><span class="tok-o">*</span><span class="tok-w"> </span><span class="tok-n">commandPaletteContext</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-k">nullptr</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">counter</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">initCommandPalette</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]()</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">commandPaletteContext</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">CreateContext</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">ImVec4</span><span class="tok-w"> </span><span class="tok-n">highlight_font_color</span><span class="tok-p">(</span><span class="tok-mf">1.0f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.0f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.0f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">1.0f</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">SetStyleColor</span><span class="tok-p">(</span><span class="tok-n">ImCmdTextType_Highlight</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">ColorConvertFloat4ToU32</span><span class="tok-p">(</span><span class="tok-n">highlight_font_color</span><span class="tok-p">));</span>

<span class="tok-w">        </span><span class="tok-c1">// Add theme command: a two steps command, with initial callback + SubsequentCallback</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">Command</span><span class="tok-w"> </span><span class="tok-n">select_theme_cmd</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">select_theme_cmd</span><span class="tok-p">.</span><span class="tok-n">Name</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;Select theme&quot;</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">select_theme_cmd</span><span class="tok-p">.</span><span class="tok-n">InitialCallback</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-p">]()</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">                </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">Prompt</span><span class="tok-p">(</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&gt;</span><span class="tok-p">{</span>
<span class="tok-w">                    </span><span class="tok-s">&quot;Classic&quot;</span><span class="tok-p">,</span>
<span class="tok-w">                    </span><span class="tok-s">&quot;Dark&quot;</span><span class="tok-p">,</span>
<span class="tok-w">                    </span><span class="tok-s">&quot;Light&quot;</span><span class="tok-p">,</span>
<span class="tok-w">                </span><span class="tok-p">});</span>
<span class="tok-w">            </span><span class="tok-p">};</span>
<span class="tok-w">            </span><span class="tok-n">select_theme_cmd</span><span class="tok-p">.</span><span class="tok-n">SubsequentCallback</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[</span><span class="tok-o">&amp;</span><span class="tok-p">](</span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">selected_option</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">                </span><span class="tok-k">switch</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">selected_option</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">                    </span><span class="tok-k">case</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">:</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">StyleColorsClassic</span><span class="tok-p">();</span><span class="tok-w"> </span><span class="tok-k">break</span><span class="tok-p">;</span>
<span class="tok-w">                    </span><span class="tok-k">case</span><span class="tok-w"> </span><span class="tok-mi">1</span><span class="tok-p">:</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">StyleColorsDark</span><span class="tok-p">();</span><span class="tok-w"> </span><span class="tok-k">break</span><span class="tok-p">;</span>
<span class="tok-w">                    </span><span class="tok-k">case</span><span class="tok-w"> </span><span class="tok-mi">2</span><span class="tok-p">:</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">StyleColorsLight</span><span class="tok-p">();</span><span class="tok-w"> </span><span class="tok-k">break</span><span class="tok-p">;</span>
<span class="tok-w">                    </span><span class="tok-k">default</span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-k">break</span><span class="tok-p">;</span>
<span class="tok-w">                </span><span class="tok-p">}</span>
<span class="tok-w">            </span><span class="tok-p">};</span>
<span class="tok-w">            </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">AddCommand</span><span class="tok-p">(</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">move</span><span class="tok-p">(</span><span class="tok-n">select_theme_cmd</span><span class="tok-p">));</span>
<span class="tok-w">        </span><span class="tok-p">}</span>

<span class="tok-w">        </span><span class="tok-c1">// Simple command that increments a counter</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">Command</span><span class="tok-w"> </span><span class="tok-n">inc_cmd</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">inc_cmd</span><span class="tok-p">.</span><span class="tok-n">Name</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-s">&quot;increment counter&quot;</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-n">inc_cmd</span><span class="tok-p">.</span><span class="tok-n">InitialCallback</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-w"> </span><span class="tok-n">counter</span><span class="tok-w"> </span><span class="tok-o">+=</span><span class="tok-w"> </span><span class="tok-mi">1</span><span class="tok-p">;</span><span class="tok-w"> </span><span class="tok-p">};</span>
<span class="tok-w">            </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">AddCommand</span><span class="tok-p">(</span><span class="tok-n">inc_cmd</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-o">!</span><span class="tok-n">wasInited</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">initCommandPalette</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">wasInited</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        # Command Palette</span>
<span class="tok-s">        [imgui-command-palette](https://github.com/hnOsmium0001/imgui-command-palette.git) provides a Sublime Text or VSCode style command palette in ImGui</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">io</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetIO</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">io</span><span class="tok-p">.</span><span class="tok-n">KeyCtrl</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">io</span><span class="tok-p">.</span><span class="tok-n">KeyShift</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsKeyPressed</span><span class="tok-p">(</span><span class="tok-n">ImGuiKey_P</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">showCommandPalette</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-o">!</span><span class="tok-w"> </span><span class="tok-n">showCommandPalette</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">showCommandPalette</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-n">ImCmd</span><span class="tok-o">::</span><span class="tok-n">CommandPaletteWindow</span><span class="tok-p">(</span><span class="tok-s">&quot;CommandPalette&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-o">&amp;</span><span class="tok-n">showCommandPalette</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;Press Ctrl+Shift+P to bring up the command palette&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Text</span><span class="tok-p">(</span><span class="tok-s">&quot;counter=%i&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">counter</span><span class="tok-p">);</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">DemoCoolBar</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">ShowCoolBarButton</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[](</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">label</span><span class="tok-p">)</span><span class="tok-w"> </span><span class="tok-o">-&gt;</span><span class="tok-w"> </span><span class="tok-kt">bool</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-kt">float</span><span class="tok-w"> </span><span class="tok-n">w</span><span class="tok-w">         </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetCoolBarItemWidth</span><span class="tok-p">();</span>

<span class="tok-w">        </span><span class="tok-c1">// Display transparent image and check if clicked</span>
<span class="tok-w">        </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">ImageFromAsset</span><span class="tok-p">(</span><span class="tok-s">&quot;images/bear_transparent.png&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImVec2</span><span class="tok-p">(</span><span class="tok-n">w</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">w</span><span class="tok-p">));</span>
<span class="tok-w">        </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">clicked</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsItemHovered</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&amp;&amp;</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">IsMouseClicked</span><span class="tok-p">(</span><span class="tok-mi">0</span><span class="tok-p">);</span>

<span class="tok-w">        </span><span class="tok-c1">// Optional: add a label on the image</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">ImVec2</span><span class="tok-w"> </span><span class="tok-n">topLeftCorner</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetItemRectMin</span><span class="tok-p">();</span>
<span class="tok-w">            </span><span class="tok-n">ImVec2</span><span class="tok-w"> </span><span class="tok-n">textPos</span><span class="tok-p">(</span><span class="tok-n">topLeftCorner</span><span class="tok-p">.</span><span class="tok-n">x</span><span class="tok-w"> </span><span class="tok-o">+</span><span class="tok-w"> </span><span class="tok-n">ImmApp</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">(</span><span class="tok-mf">1.f</span><span class="tok-p">),</span><span class="tok-w"> </span><span class="tok-n">topLeftCorner</span><span class="tok-p">.</span><span class="tok-n">y</span><span class="tok-w"> </span><span class="tok-o">+</span><span class="tok-w"> </span><span class="tok-n">ImmApp</span><span class="tok-o">::</span><span class="tok-n">EmSize</span><span class="tok-p">(</span><span class="tok-mf">1.f</span><span class="tok-p">));</span>
<span class="tok-w">            </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">GetForegroundDrawList</span><span class="tok-p">()</span><span class="tok-o">-&gt;</span><span class="tok-n">AddText</span><span class="tok-p">(</span><span class="tok-n">textPos</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mh">0xFFFFFFFF</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">label</span><span class="tok-p">.</span><span class="tok-n">c_str</span><span class="tok-p">());</span>
<span class="tok-w">        </span><span class="tok-p">}</span>

<span class="tok-w">        </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">clicked</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">};</span>


<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">buttonLabels</span><span class="tok-w"> </span><span class="tok-p">{</span><span class="tok-s">&quot;A&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;B&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;C&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;D&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;E&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-s">&quot;F&quot;</span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        # ImCoolBar</span>
<span class="tok-s">        ImCoolBar provides a dock-like Cool bar for Dear ImGui</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">ImCoolBarConfig</span><span class="tok-w"> </span><span class="tok-n">coolBarConfig</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">coolBarConfig</span><span class="tok-p">.</span><span class="tok-n">anchor</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImVec2</span><span class="tok-p">(</span><span class="tok-mf">0.5f</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-mf">0.07f</span><span class="tok-p">);</span><span class="tok-w"> </span><span class="tok-c1">// position in the window (ratio of window size)</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">BeginCoolBar</span><span class="tok-p">(</span><span class="tok-s">&quot;##CoolBarMain&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">ImCoolBarFlags_Horizontal</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">coolBarConfig</span><span class="tok-p">))</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">label</span><span class="tok-o">:</span><span class="tok-w"> </span><span class="tok-n">buttonLabels</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">CoolBarItem</span><span class="tok-p">())</span>
<span class="tok-w">            </span><span class="tok-p">{</span>
<span class="tok-w">                </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ShowCoolBarButton</span><span class="tok-p">(</span><span class="tok-n">label</span><span class="tok-p">))</span>
<span class="tok-w">                    </span><span class="tok-n">printf</span><span class="tok-p">(</span><span class="tok-s">&quot;Clicked %s</span><span class="tok-se">\n</span><span class="tok-s">&quot;</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">label</span><span class="tok-p">.</span><span class="tok-n">c_str</span><span class="tok-p">());</span>
<span class="tok-w">            </span><span class="tok-p">}</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">EndCoolBar</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span><span class="tok-w"> </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">demo_widgets</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">DemoCoolBar</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoToggle</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoSpinner</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoKnobs</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoCommandPalette</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoPortableFileDialogs</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">NewLine</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">DemoImFileDialog</span><span class="tok-p">();</span>
<span class="tok-p">}</span></code></pre>
</div>
</div>
</div>
</details>
<details>
<summary class="title">Click to see the widgets code in Python</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="python"><span></span><span class="tok-c1"># Part of ImGui Bundle - MIT License - Copyright (c) 2022-2025 Pascal Thomet - https://github.com/pthom/imgui_bundle</span>
<span class="tok-kn">from</span> <span class="tok-nn">typing</span> <span class="tok-kn">import</span> <span class="tok-n">List</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-p">(</span>
    <span class="tok-n">imgui</span><span class="tok-p">,</span>
    <span class="tok-n">hello_imgui</span><span class="tok-p">,</span>
    <span class="tok-n">imgui_md</span><span class="tok-p">,</span>
    <span class="tok-n">imgui_toggle</span><span class="tok-p">,</span>
    <span class="tok-n">ImVec2</span><span class="tok-p">,</span>
    <span class="tok-n">immapp</span><span class="tok-p">,</span>
    <span class="tok-n">ImVec4</span><span class="tok-p">,</span>
    <span class="tok-n">im_cool_bar</span><span class="tok-p">,</span>
    <span class="tok-n">icons_fontawesome</span><span class="tok-p">,</span>
<span class="tok-p">)</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">imgui_command_palette</span> <span class="tok-k">as</span> <span class="tok-n">imcmd</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">portable_file_dialogs</span> <span class="tok-k">as</span> <span class="tok-n">pfd</span>


<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span><span class="tok-n">knob_float_value</span><span class="tok-o">=</span><span class="tok-mi">0</span><span class="tok-p">,</span> <span class="tok-n">knob_int_value</span><span class="tok-o">=</span><span class="tok-mi">0</span><span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_knobs</span><span class="tok-p">():</span>
    <span class="tok-n">static</span> <span class="tok-o">=</span> <span class="tok-n">demo_knobs</span>
    <span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">imgui_knobs</span>

    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd"># Knobs</span>
<span class="tok-sd">  [imgui-knobs](https://github.com/altschuler/imgui-knobs) provides knobs for ImGui.&quot;&quot;&quot;</span>
    <span class="tok-p">)</span>
    <span class="tok-n">knob_types</span> <span class="tok-o">=</span> <span class="tok-p">{</span>
        <span class="tok-s2">&quot;tick&quot;</span><span class="tok-p">:</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">ImGuiKnobVariant_</span><span class="tok-o">.</span><span class="tok-n">tick</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;dot&quot;</span><span class="tok-p">:</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">ImGuiKnobVariant_</span><span class="tok-o">.</span><span class="tok-n">dot</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;space&quot;</span><span class="tok-p">:</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">ImGuiKnobVariant_</span><span class="tok-o">.</span><span class="tok-n">space</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;stepped&quot;</span><span class="tok-p">:</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">ImGuiKnobVariant_</span><span class="tok-o">.</span><span class="tok-n">stepped</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;wiper&quot;</span><span class="tok-p">:</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">ImGuiKnobVariant_</span><span class="tok-o">.</span><span class="tok-n">wiper</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;wiper_dot&quot;</span><span class="tok-p">:</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">ImGuiKnobVariant_</span><span class="tok-o">.</span><span class="tok-n">wiper_dot</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;wiper_only&quot;</span><span class="tok-p">:</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">ImGuiKnobVariant_</span><span class="tok-o">.</span><span class="tok-n">wiper_only</span><span class="tok-p">,</span>
    <span class="tok-p">}</span>

    <span class="tok-k">def</span> <span class="tok-nf">show_float_knobs</span><span class="tok-p">(</span><span class="tok-n">knob_size</span><span class="tok-p">:</span> <span class="tok-nb">float</span><span class="tok-p">):</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">push_id</span><span class="tok-p">(</span><span class="tok-sa">f</span><span class="tok-s2">&quot;</span><span class="tok-si">{</span><span class="tok-n">knob_size</span><span class="tok-si">}</span><span class="tok-s2">_float&quot;</span><span class="tok-p">)</span>
        <span class="tok-k">for</span> <span class="tok-n">knob_typename</span><span class="tok-p">,</span> <span class="tok-n">knob_type</span> <span class="tok-ow">in</span> <span class="tok-n">knob_types</span><span class="tok-o">.</span><span class="tok-n">items</span><span class="tok-p">():</span>
            <span class="tok-n">changed</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">knob_float_value</span> <span class="tok-o">=</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">knob</span><span class="tok-p">(</span>
                <span class="tok-n">knob_typename</span><span class="tok-p">,</span>
                <span class="tok-n">p_value</span><span class="tok-o">=</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">knob_float_value</span><span class="tok-p">,</span>
                <span class="tok-n">v_min</span><span class="tok-o">=</span><span class="tok-mf">0.0</span><span class="tok-p">,</span>
                <span class="tok-n">v_max</span><span class="tok-o">=</span><span class="tok-mf">1.0</span><span class="tok-p">,</span>
                <span class="tok-n">speed</span><span class="tok-o">=</span><span class="tok-mi">0</span><span class="tok-p">,</span>
                <span class="tok-nb">format</span><span class="tok-o">=</span><span class="tok-s2">&quot;</span><span class="tok-si">%.2f</span><span class="tok-s2">&quot;</span><span class="tok-p">,</span>
                <span class="tok-n">variant</span><span class="tok-o">=</span><span class="tok-n">knob_type</span><span class="tok-o">.</span><span class="tok-n">value</span><span class="tok-p">,</span>
                <span class="tok-n">size</span><span class="tok-o">=</span><span class="tok-n">knob_size</span><span class="tok-p">,</span>
                <span class="tok-n">flags</span><span class="tok-o">=</span><span class="tok-mi">0</span><span class="tok-p">,</span>
                <span class="tok-n">steps</span><span class="tok-o">=</span><span class="tok-mi">100</span><span class="tok-p">,</span>
            <span class="tok-p">)</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_id</span><span class="tok-p">()</span>

    <span class="tok-k">def</span> <span class="tok-nf">show_int_knobs</span><span class="tok-p">(</span><span class="tok-n">knob_size</span><span class="tok-p">:</span> <span class="tok-nb">float</span><span class="tok-p">):</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">push_id</span><span class="tok-p">(</span><span class="tok-sa">f</span><span class="tok-s2">&quot;</span><span class="tok-si">{</span><span class="tok-n">knob_size</span><span class="tok-si">}</span><span class="tok-s2">_int&quot;</span><span class="tok-p">)</span>
        <span class="tok-k">for</span> <span class="tok-n">knob_typename</span><span class="tok-p">,</span> <span class="tok-n">knob_type</span> <span class="tok-ow">in</span> <span class="tok-n">knob_types</span><span class="tok-o">.</span><span class="tok-n">items</span><span class="tok-p">():</span>
            <span class="tok-n">changed</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">knob_int_value</span> <span class="tok-o">=</span> <span class="tok-n">imgui_knobs</span><span class="tok-o">.</span><span class="tok-n">knob_int</span><span class="tok-p">(</span>
                <span class="tok-n">knob_typename</span><span class="tok-p">,</span>
                <span class="tok-n">p_value</span><span class="tok-o">=</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">knob_int_value</span><span class="tok-p">,</span>
                <span class="tok-n">v_min</span><span class="tok-o">=</span><span class="tok-mi">0</span><span class="tok-p">,</span>
                <span class="tok-n">v_max</span><span class="tok-o">=</span><span class="tok-mi">15</span><span class="tok-p">,</span>
                <span class="tok-n">speed</span><span class="tok-o">=</span><span class="tok-mi">0</span><span class="tok-p">,</span>
                <span class="tok-nb">format</span><span class="tok-o">=</span><span class="tok-s2">&quot;</span><span class="tok-si">%02i</span><span class="tok-s2">&quot;</span><span class="tok-p">,</span>
                <span class="tok-n">variant</span><span class="tok-o">=</span><span class="tok-n">knob_type</span><span class="tok-o">.</span><span class="tok-n">value</span><span class="tok-p">,</span>
                <span class="tok-n">steps</span><span class="tok-o">=</span><span class="tok-mi">10</span><span class="tok-p">,</span>
                <span class="tok-n">size</span><span class="tok-o">=</span><span class="tok-n">knob_size</span><span class="tok-p">,</span>
            <span class="tok-p">)</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_id</span><span class="tok-p">()</span>

    <span class="tok-n">knobs_size_small</span> <span class="tok-o">=</span> <span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">()</span> <span class="tok-o">*</span> <span class="tok-mf">2.5</span>
    <span class="tok-n">knobs_size_big</span> <span class="tok-o">=</span> <span class="tok-n">knobs_size_small</span> <span class="tok-o">*</span> <span class="tok-mf">1.3</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin_group</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Some small knobs&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">show_float_knobs</span><span class="tok-p">(</span><span class="tok-n">knobs_size_small</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end_group</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">begin_group</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Some big knobs (int values)&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">show_int_knobs</span><span class="tok-p">(</span><span class="tok-n">knobs_size_big</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">end_group</span><span class="tok-p">()</span>


<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span><span class="tok-n">show_full_demo</span><span class="tok-o">=</span><span class="tok-kc">False</span><span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_spinner</span><span class="tok-p">():</span>
    <span class="tok-n">static</span> <span class="tok-o">=</span> <span class="tok-n">demo_spinner</span>
    <span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">imspinner</span>

    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd"># Spinners</span>
<span class="tok-sd">  [imspinner](https://github.com/dalerank/imspinner) provides spinners for ImGui.&quot;&quot;&quot;</span>
    <span class="tok-p">)</span>

    <span class="tok-n">color</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">ImColor</span><span class="tok-p">(</span><span class="tok-mf">0.3</span><span class="tok-p">,</span> <span class="tok-mf">0.5</span><span class="tok-p">,</span> <span class="tok-mf">0.9</span><span class="tok-p">,</span> <span class="tok-mf">1.0</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;spinner_moving_dots&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">imspinner</span><span class="tok-o">.</span><span class="tok-n">spinner_moving_dots</span><span class="tok-p">(</span><span class="tok-s2">&quot;spinner_moving_dots&quot;</span><span class="tok-p">,</span> <span class="tok-mf">20.0</span><span class="tok-p">,</span> <span class="tok-mf">4.0</span><span class="tok-p">,</span> <span class="tok-n">color</span><span class="tok-p">,</span> <span class="tok-mi">20</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-n">radius</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_font_size</span><span class="tok-p">()</span> <span class="tok-o">/</span> <span class="tok-mf">1.8</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;spinner_arc_rotation&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">imspinner</span><span class="tok-o">.</span><span class="tok-n">spinner_arc_rotation</span><span class="tok-p">(</span><span class="tok-s2">&quot;spinner_arc_rotation&quot;</span><span class="tok-p">,</span> <span class="tok-n">radius</span><span class="tok-p">,</span> <span class="tok-mf">4.0</span><span class="tok-p">,</span> <span class="tok-n">color</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-n">radius1</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_font_size</span><span class="tok-p">()</span> <span class="tok-o">/</span> <span class="tok-mf">2.5</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;spinner_ang_triple&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">imspinner</span><span class="tok-o">.</span><span class="tok-n">spinner_ang_triple</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;spinner_ang_triple&quot;</span><span class="tok-p">,</span>
        <span class="tok-n">radius1</span><span class="tok-p">,</span>
        <span class="tok-n">radius1</span> <span class="tok-o">*</span> <span class="tok-mf">1.5</span><span class="tok-p">,</span>
        <span class="tok-n">radius1</span> <span class="tok-o">*</span> <span class="tok-mf">2.0</span><span class="tok-p">,</span>
        <span class="tok-mf">2.5</span><span class="tok-p">,</span>
        <span class="tok-n">color</span><span class="tok-p">,</span>
        <span class="tok-n">color</span><span class="tok-p">,</span>
        <span class="tok-n">color</span><span class="tok-p">,</span>
    <span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">_</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">show_full_demo</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">checkbox</span><span class="tok-p">(</span><span class="tok-s2">&quot;Show full spinners demo&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">show_full_demo</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">show_full_demo</span><span class="tok-p">:</span>
        <span class="tok-n">imspinner</span><span class="tok-o">.</span><span class="tok-n">demo_spinners</span><span class="tok-p">()</span>


<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span><span class="tok-n">flag</span><span class="tok-o">=</span><span class="tok-kc">True</span><span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_toggle</span><span class="tok-p">():</span>
    <span class="tok-n">static</span> <span class="tok-o">=</span> <span class="tok-n">demo_toggle</span>
    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render_unindented</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">        # Toggle Switch</span>
<span class="tok-sd">          [imgui_toggle](https://github.com/cmdwtf/imgui_toggle) provides toggle switches for ImGui.&quot;&quot;&quot;</span>
    <span class="tok-p">)</span>

    <span class="tok-n">_changed</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span> <span class="tok-o">=</span> <span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">toggle</span><span class="tok-p">(</span><span class="tok-s2">&quot;Default Toggle&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-n">_changed</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span> <span class="tok-o">=</span> <span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">toggle</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;Animated Toggle&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span><span class="tok-p">,</span> <span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">ToggleFlags_</span><span class="tok-o">.</span><span class="tok-n">animated</span><span class="tok-o">.</span><span class="tok-n">value</span>
    <span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-n">toggle_config</span> <span class="tok-o">=</span> <span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">material_style</span><span class="tok-p">()</span>
    <span class="tok-n">toggle_config</span><span class="tok-o">.</span><span class="tok-n">animation_duration</span> <span class="tok-o">=</span> <span class="tok-mf">0.4</span>
    <span class="tok-n">_changed</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span> <span class="tok-o">=</span> <span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">toggle</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;Material Style (with slowed anim)&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span><span class="tok-p">,</span> <span class="tok-n">config</span><span class="tok-o">=</span><span class="tok-n">toggle_config</span>
    <span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">_changed</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span> <span class="tok-o">=</span> <span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">toggle</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;iOS style&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span><span class="tok-p">,</span> <span class="tok-n">config</span><span class="tok-o">=</span><span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">ios_style</span><span class="tok-p">(</span><span class="tok-n">size_scale</span><span class="tok-o">=</span><span class="tok-mf">0.2</span><span class="tok-p">)</span>
    <span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">_changed</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span> <span class="tok-o">=</span> <span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">toggle</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;iOS style (light)&quot;</span><span class="tok-p">,</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">flag</span><span class="tok-p">,</span>
        <span class="tok-n">config</span><span class="tok-o">=</span><span class="tok-n">imgui_toggle</span><span class="tok-o">.</span><span class="tok-n">ios_style</span><span class="tok-p">(</span><span class="tok-n">size_scale</span><span class="tok-o">=</span><span class="tok-mf">0.2</span><span class="tok-p">,</span> <span class="tok-n">light_mode</span><span class="tok-o">=</span><span class="tok-kc">True</span><span class="tok-p">),</span>
    <span class="tok-p">)</span>


<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span>
    <span class="tok-n">open_file_dialog</span><span class="tok-o">=</span><span class="tok-kc">None</span><span class="tok-p">,</span>
    <span class="tok-n">open_file_multiselect</span><span class="tok-o">=</span><span class="tok-kc">None</span><span class="tok-p">,</span>
    <span class="tok-n">save_file_dialog</span><span class="tok-o">=</span><span class="tok-kc">None</span><span class="tok-p">,</span>
    <span class="tok-n">select_folder_dialog</span><span class="tok-o">=</span><span class="tok-kc">None</span><span class="tok-p">,</span>
    <span class="tok-n">last_file_selection</span><span class="tok-o">=</span><span class="tok-s2">&quot;&quot;</span><span class="tok-p">,</span>
    <span class="tok-c1"># Messages and Notifications</span>
    <span class="tok-n">icon_type</span><span class="tok-o">=</span><span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">icon</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span>
    <span class="tok-n">message_dialog</span><span class="tok-o">=</span><span class="tok-kc">None</span><span class="tok-p">,</span>
    <span class="tok-n">message_choice_type</span><span class="tok-o">=</span><span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">choice</span><span class="tok-o">.</span><span class="tok-n">ok</span><span class="tok-p">,</span>
<span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_portable_file_dialogs</span><span class="tok-p">():</span>
    <span class="tok-c1"># from imgui_bundle import portable_file_dialogs as pfd</span>
    <span class="tok-n">static</span> <span class="tok-o">=</span> <span class="tok-n">demo_portable_file_dialogs</span>


    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">push_id</span><span class="tok-p">(</span><span class="tok-s2">&quot;pfd&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render_unindented</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">        # Portable File Dialogs</span>
<span class="tok-sd">         [portable-file-dialogs](https://github.com/samhocevar/portable-file-dialogs) provides file dialogs</span>
<span class="tok-sd">         as well as notifications and messages. They will use the native dialogs and notifications on each platform.</span>
<span class="tok-sd">    &quot;&quot;&quot;</span>
    <span class="tok-p">)</span>

    <span class="tok-k">def</span> <span class="tok-nf">log_result</span><span class="tok-p">(</span><span class="tok-n">what</span><span class="tok-p">:</span> <span class="tok-nb">str</span><span class="tok-p">):</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">last_file_selection</span> <span class="tok-o">=</span> <span class="tok-n">what</span>

    <span class="tok-k">def</span> <span class="tok-nf">log_result_list</span><span class="tok-p">(</span><span class="tok-n">whats</span><span class="tok-p">:</span> <span class="tok-n">List</span><span class="tok-p">[</span><span class="tok-nb">str</span><span class="tok-p">]):</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">last_file_selection</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;</span><span class="tok-se">\n</span><span class="tok-s2">&quot;</span><span class="tok-o">.</span><span class="tok-n">join</span><span class="tok-p">(</span><span class="tok-n">whats</span><span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;      ---   File dialogs   ---&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Open file&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_dialog</span> <span class="tok-o">=</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">open_file</span><span class="tok-p">(</span><span class="tok-s2">&quot;Select file&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_dialog</span> <span class="tok-ow">is</span> <span class="tok-ow">not</span> <span class="tok-kc">None</span> <span class="tok-ow">and</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_dialog</span><span class="tok-o">.</span><span class="tok-n">ready</span><span class="tok-p">():</span>
        <span class="tok-n">log_result_list</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_dialog</span><span class="tok-o">.</span><span class="tok-n">result</span><span class="tok-p">())</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_dialog</span> <span class="tok-o">=</span> <span class="tok-kc">None</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Open file (multiselect)&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_multiselect</span> <span class="tok-o">=</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">open_file</span><span class="tok-p">(</span>
            <span class="tok-s2">&quot;Select file&quot;</span><span class="tok-p">,</span> <span class="tok-n">options</span><span class="tok-o">=</span><span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">opt</span><span class="tok-o">.</span><span class="tok-n">multiselect</span>
        <span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-p">(</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_multiselect</span> <span class="tok-ow">is</span> <span class="tok-ow">not</span> <span class="tok-kc">None</span>
        <span class="tok-ow">and</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_multiselect</span><span class="tok-o">.</span><span class="tok-n">ready</span><span class="tok-p">()</span>
    <span class="tok-p">):</span>
        <span class="tok-n">log_result_list</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_multiselect</span><span class="tok-o">.</span><span class="tok-n">result</span><span class="tok-p">())</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">open_file_multiselect</span> <span class="tok-o">=</span> <span class="tok-kc">None</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Save file&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">save_file_dialog</span> <span class="tok-o">=</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">save_file</span><span class="tok-p">(</span><span class="tok-s2">&quot;Save file&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">save_file_dialog</span> <span class="tok-ow">is</span> <span class="tok-ow">not</span> <span class="tok-kc">None</span> <span class="tok-ow">and</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">save_file_dialog</span><span class="tok-o">.</span><span class="tok-n">ready</span><span class="tok-p">():</span>
        <span class="tok-n">log_result</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">save_file_dialog</span><span class="tok-o">.</span><span class="tok-n">result</span><span class="tok-p">())</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">save_file_dialog</span> <span class="tok-o">=</span> <span class="tok-kc">None</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Select folder&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">select_folder_dialog</span> <span class="tok-o">=</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">select_folder</span><span class="tok-p">(</span><span class="tok-s2">&quot;Select folder&quot;</span><span class="tok-p">)</span>
    <span class="tok-k">if</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">select_folder_dialog</span> <span class="tok-ow">is</span> <span class="tok-ow">not</span> <span class="tok-kc">None</span> <span class="tok-ow">and</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">select_folder_dialog</span><span class="tok-o">.</span><span class="tok-n">ready</span><span class="tok-p">():</span>
        <span class="tok-n">log_result</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">select_folder_dialog</span><span class="tok-o">.</span><span class="tok-n">result</span><span class="tok-p">())</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">select_folder_dialog</span> <span class="tok-o">=</span> <span class="tok-kc">None</span>

    <span class="tok-k">if</span> <span class="tok-nb">len</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">last_file_selection</span><span class="tok-p">)</span> <span class="tok-o">&gt;</span> <span class="tok-mi">0</span><span class="tok-p">:</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">last_file_selection</span><span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;      ---   Notifications and messages   ---&quot;</span><span class="tok-p">)</span>

    <span class="tok-c1"># icon type</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Icon type&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">for</span> <span class="tok-n">notification_icon</span> <span class="tok-ow">in</span> <span class="tok-p">(</span><span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">icon</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">icon</span><span class="tok-o">.</span><span class="tok-n">warning</span><span class="tok-p">,</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">icon</span><span class="tok-o">.</span><span class="tok-n">error</span><span class="tok-p">):</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">radio_button</span><span class="tok-p">(</span><span class="tok-n">notification_icon</span><span class="tok-o">.</span><span class="tok-n">name</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">icon_type</span> <span class="tok-o">==</span> <span class="tok-n">notification_icon</span><span class="tok-p">):</span>
            <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">icon_type</span> <span class="tok-o">=</span> <span class="tok-n">notification_icon</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Add Notif&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">notify</span><span class="tok-p">(</span><span class="tok-s2">&quot;Notification title&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;This is an example notification&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">icon_type</span><span class="tok-p">)</span>

    <span class="tok-c1"># messages</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-c1"># 1. Display the message</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Add message&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">message_dialog</span> <span class="tok-o">=</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">message</span><span class="tok-p">(</span><span class="tok-s2">&quot;Message title&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;This is an example message&quot;</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">message_choice_type</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">icon_type</span><span class="tok-p">)</span>
    <span class="tok-c1"># 2. Handle the message result</span>
    <span class="tok-k">if</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">message_dialog</span> <span class="tok-ow">is</span> <span class="tok-ow">not</span> <span class="tok-kc">None</span> <span class="tok-ow">and</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">message_dialog</span><span class="tok-o">.</span><span class="tok-n">ready</span><span class="tok-p">():</span>
        <span class="tok-nb">print</span><span class="tok-p">(</span><span class="tok-s2">&quot;msg ready: &quot;</span> <span class="tok-o">+</span> <span class="tok-nb">str</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">message_dialog</span><span class="tok-o">.</span><span class="tok-n">result</span><span class="tok-p">()))</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">message_dialog</span> <span class="tok-o">=</span> <span class="tok-kc">None</span>
    <span class="tok-c1"># Optional: Select the message type</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">for</span> <span class="tok-n">choice_type</span> <span class="tok-ow">in</span> <span class="tok-p">(</span><span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">choice</span><span class="tok-o">.</span><span class="tok-n">ok</span><span class="tok-p">,</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">choice</span><span class="tok-o">.</span><span class="tok-n">yes_no</span><span class="tok-p">,</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">choice</span><span class="tok-o">.</span><span class="tok-n">yes_no_cancel</span><span class="tok-p">,</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">choice</span><span class="tok-o">.</span><span class="tok-n">retry_cancel</span><span class="tok-p">,</span> <span class="tok-n">pfd</span><span class="tok-o">.</span><span class="tok-n">choice</span><span class="tok-o">.</span><span class="tok-n">abort_retry_ignore</span><span class="tok-p">):</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">radio_button</span><span class="tok-p">(</span><span class="tok-n">choice_type</span><span class="tok-o">.</span><span class="tok-n">name</span><span class="tok-p">,</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">message_choice_type</span> <span class="tok-o">==</span> <span class="tok-n">choice_type</span><span class="tok-p">):</span>
            <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">message_choice_type</span> <span class="tok-o">=</span> <span class="tok-n">choice_type</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_id</span><span class="tok-p">()</span>


<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span><span class="tok-n">selected_filename</span><span class="tok-o">=</span><span class="tok-s2">&quot;&quot;</span><span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_imfile_dialog</span><span class="tok-p">():</span>
    <span class="tok-n">static</span> <span class="tok-o">=</span> <span class="tok-n">demo_imfile_dialog</span>  <span class="tok-c1"># Access to static variable via static</span>
    <span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">has_submodule</span>
    <span class="tok-k">if</span> <span class="tok-ow">not</span> <span class="tok-n">has_submodule</span><span class="tok-p">(</span><span class="tok-s2">&quot;im_file_dialog&quot;</span><span class="tok-p">):</span>
        <span class="tok-k">return</span>
    <span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">im_file_dialog</span> <span class="tok-k">as</span> <span class="tok-n">ifd</span>
    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render_unindented</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">        # ImFileDialog</span>
<span class="tok-sd">         [ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui.</span>
<span class="tok-sd">        &quot;&quot;&quot;</span>
    <span class="tok-p">)</span>
    <span class="tok-c1"># Warning / low support</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-n">icons_fontawesome</span><span class="tok-o">.</span><span class="tok-n">ICON_FA_EXCLAMATION_TRIANGLE</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">set_item_tooltip</span><span class="tok-p">(</span><span class="tok-s2">&quot;&quot;&quot;</span>
<span class="tok-s2">    It is advised to use Portable File Dialogs instead, which offer native dialogs on each platform,</span>
<span class="tok-s2">    as well as notifications and messages.</span>

<span class="tok-s2">    Known limitations of ImFileDialog:</span>
<span class="tok-s2">    * Not adapted for High DPI resolution under windows</span>
<span class="tok-s2">    * No support for multi-selection</span>
<span class="tok-s2">    * Will not work under python with a pure python backend (requires to use `immapp.run()`)</span>
<span class="tok-s2">    &quot;&quot;&quot;</span><span class="tok-p">)</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Open file&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">open</span><span class="tok-p">(</span>
            <span class="tok-s2">&quot;ShaderOpenDialog&quot;</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;Open a shader&quot;</span><span class="tok-p">,</span>
            <span class="tok-s2">&quot;Image file (*.png*.jpg*.jpeg*.bmp*.tga).png,.jpg,.jpeg,.bmp,.tga,.*&quot;</span><span class="tok-p">,</span>
            <span class="tok-kc">True</span><span class="tok-p">,</span>
        <span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Open directory&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">open</span><span class="tok-p">(</span><span class="tok-s2">&quot;DirectoryOpenDialog&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Open a directory&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Save file&quot;</span><span class="tok-p">):</span>
        <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">save</span><span class="tok-p">(</span>
            <span class="tok-s2">&quot;ShaderSaveDialog&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Save a shader&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;*.sprj .sprj&quot;</span>
        <span class="tok-p">)</span>

    <span class="tok-k">if</span> <span class="tok-nb">len</span><span class="tok-p">(</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">selected_filename</span><span class="tok-p">)</span> <span class="tok-o">&gt;</span> <span class="tok-mi">0</span><span class="tok-p">:</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-sa">f</span><span class="tok-s2">&quot;Last file selection:</span><span class="tok-se">\n</span><span class="tok-s2">  </span><span class="tok-si">{</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">selected_filename</span><span class="tok-si">}</span><span class="tok-s2">&quot;</span><span class="tok-p">)</span>

    <span class="tok-c1"># file dialogs</span>
    <span class="tok-k">if</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">is_done</span><span class="tok-p">(</span><span class="tok-s2">&quot;ShaderOpenDialog&quot;</span><span class="tok-p">):</span>
        <span class="tok-k">if</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">has_result</span><span class="tok-p">():</span>
            <span class="tok-c1"># get_results: plural form - ShaderOpenDialog supports multi-selection</span>
            <span class="tok-n">res</span> <span class="tok-o">=</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">get_results</span><span class="tok-p">()</span>
            <span class="tok-n">filenames</span> <span class="tok-o">=</span> <span class="tok-p">[</span><span class="tok-n">f</span><span class="tok-o">.</span><span class="tok-n">path</span><span class="tok-p">()</span> <span class="tok-k">for</span> <span class="tok-n">f</span> <span class="tok-ow">in</span> <span class="tok-n">res</span><span class="tok-p">]</span>
            <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">selected_filename</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;</span><span class="tok-se">\n</span><span class="tok-s2">  &quot;</span><span class="tok-o">.</span><span class="tok-n">join</span><span class="tok-p">(</span><span class="tok-n">filenames</span><span class="tok-p">)</span>

        <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">close</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">is_done</span><span class="tok-p">(</span><span class="tok-s2">&quot;DirectoryOpenDialog&quot;</span><span class="tok-p">):</span>
        <span class="tok-k">if</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">has_result</span><span class="tok-p">():</span>
            <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">selected_filename</span> <span class="tok-o">=</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">get_result</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">path</span><span class="tok-p">()</span>

        <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">close</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">is_done</span><span class="tok-p">(</span><span class="tok-s2">&quot;ShaderSaveDialog&quot;</span><span class="tok-p">):</span>
        <span class="tok-k">if</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">has_result</span><span class="tok-p">():</span>
            <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">selected_filename</span> <span class="tok-o">=</span> <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">get_result</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">path</span><span class="tok-p">()</span>

        <span class="tok-n">ifd</span><span class="tok-o">.</span><span class="tok-n">FileDialog</span><span class="tok-o">.</span><span class="tok-n">instance</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">close</span><span class="tok-p">()</span>


<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span>
    <span class="tok-n">was_inited</span><span class="tok-o">=</span><span class="tok-kc">False</span><span class="tok-p">,</span>
    <span class="tok-n">show_command_palette</span><span class="tok-o">=</span><span class="tok-kc">False</span><span class="tok-p">,</span>
    <span class="tok-n">counter</span><span class="tok-o">=</span><span class="tok-mi">0</span><span class="tok-p">,</span>
    <span class="tok-n">command_palette_context</span><span class="tok-o">=</span><span class="tok-kc">None</span><span class="tok-p">,</span>
<span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_command_palette</span><span class="tok-p">():</span>
    <span class="tok-n">static</span> <span class="tok-o">=</span> <span class="tok-n">demo_command_palette</span>

    <span class="tok-k">def</span> <span class="tok-nf">init_command_palette</span><span class="tok-p">():</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">command_palette_context</span> <span class="tok-o">=</span> <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">ContextWrapper</span><span class="tok-p">()</span>
        <span class="tok-n">highlight_font_color</span> <span class="tok-o">=</span> <span class="tok-n">ImVec4</span><span class="tok-p">(</span><span class="tok-mf">1.0</span><span class="tok-p">,</span> <span class="tok-mf">0.0</span><span class="tok-p">,</span> <span class="tok-mf">0.0</span><span class="tok-p">,</span> <span class="tok-mf">1.0</span><span class="tok-p">)</span>
        <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">set_style_color</span><span class="tok-p">(</span>
            <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">ImCmdTextType</span><span class="tok-o">.</span><span class="tok-n">highlight</span><span class="tok-p">,</span>
            <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">color_convert_float4_to_u32</span><span class="tok-p">(</span><span class="tok-n">highlight_font_color</span><span class="tok-p">),</span>
        <span class="tok-p">)</span>
        <span class="tok-c1"># Add theme command: a two steps command, with initial callback + SubsequentCallback</span>
        <span class="tok-n">select_theme_cmd</span> <span class="tok-o">=</span> <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">Command</span><span class="tok-p">()</span>
        <span class="tok-n">select_theme_cmd</span><span class="tok-o">.</span><span class="tok-n">name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;Select theme&quot;</span>

        <span class="tok-k">def</span> <span class="tok-nf">select_theme_cmd_initial_cb</span><span class="tok-p">():</span>
            <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">prompt</span><span class="tok-p">([</span><span class="tok-s2">&quot;Classic&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Dark&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Light&quot;</span><span class="tok-p">])</span>

        <span class="tok-k">def</span> <span class="tok-nf">select_theme_cmd_subsequent_cb</span><span class="tok-p">(</span><span class="tok-n">selected_option</span><span class="tok-p">:</span> <span class="tok-nb">int</span><span class="tok-p">):</span>
            <span class="tok-k">if</span> <span class="tok-n">selected_option</span> <span class="tok-o">==</span> <span class="tok-mi">0</span><span class="tok-p">:</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">style_colors_classic</span><span class="tok-p">()</span>
            <span class="tok-k">elif</span> <span class="tok-n">selected_option</span> <span class="tok-o">==</span> <span class="tok-mi">1</span><span class="tok-p">:</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">style_colors_dark</span><span class="tok-p">()</span>
            <span class="tok-k">elif</span> <span class="tok-n">selected_option</span> <span class="tok-o">==</span> <span class="tok-mi">2</span><span class="tok-p">:</span>
                <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">style_colors_light</span><span class="tok-p">()</span>

        <span class="tok-n">select_theme_cmd</span><span class="tok-o">.</span><span class="tok-n">initial_callback</span> <span class="tok-o">=</span> <span class="tok-n">select_theme_cmd_initial_cb</span>
        <span class="tok-n">select_theme_cmd</span><span class="tok-o">.</span><span class="tok-n">subsequent_callback</span> <span class="tok-o">=</span> <span class="tok-n">select_theme_cmd_subsequent_cb</span>
        <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">add_command</span><span class="tok-p">(</span><span class="tok-n">select_theme_cmd</span><span class="tok-p">)</span>

        <span class="tok-c1"># Simple command that increments a counter</span>
        <span class="tok-n">inc_cmd</span> <span class="tok-o">=</span> <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">Command</span><span class="tok-p">()</span>
        <span class="tok-n">inc_cmd</span><span class="tok-o">.</span><span class="tok-n">name</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;increment counter&quot;</span>

        <span class="tok-k">def</span> <span class="tok-nf">inc_counter</span><span class="tok-p">():</span>
            <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">counter</span> <span class="tok-o">+=</span> <span class="tok-mi">1</span>

        <span class="tok-n">inc_cmd</span><span class="tok-o">.</span><span class="tok-n">initial_callback</span> <span class="tok-o">=</span> <span class="tok-n">inc_counter</span>
        <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">add_command</span><span class="tok-p">(</span><span class="tok-n">inc_cmd</span><span class="tok-p">)</span>

    <span class="tok-k">if</span> <span class="tok-ow">not</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">was_inited</span><span class="tok-p">:</span>
        <span class="tok-n">init_command_palette</span><span class="tok-p">()</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">was_inited</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>

    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render_unindented</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">        # Command Palette</span>
<span class="tok-sd">        [imgui-command-palette](https://github.com/hnOsmium0001/imgui-command-palette.git) provides a Sublime Text or VSCode style command palette in ImGui</span>
<span class="tok-sd">        &quot;&quot;&quot;</span>
    <span class="tok-p">)</span>

    <span class="tok-n">io</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_io</span><span class="tok-p">()</span>
    <span class="tok-k">if</span> <span class="tok-n">io</span><span class="tok-o">.</span><span class="tok-n">key_ctrl</span> <span class="tok-ow">and</span> <span class="tok-n">io</span><span class="tok-o">.</span><span class="tok-n">key_shift</span> <span class="tok-ow">and</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_key_pressed</span><span class="tok-p">(</span><span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">Key</span><span class="tok-o">.</span><span class="tok-n">p</span><span class="tok-p">):</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">show_command_palette</span> <span class="tok-o">=</span> <span class="tok-ow">not</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">show_command_palette</span>

    <span class="tok-k">if</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">show_command_palette</span><span class="tok-p">:</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">show_command_palette</span> <span class="tok-o">=</span> <span class="tok-n">imcmd</span><span class="tok-o">.</span><span class="tok-n">command_palette_window</span><span class="tok-p">(</span>
            <span class="tok-s2">&quot;CommandPalette&quot;</span><span class="tok-p">,</span> <span class="tok-kc">True</span>
        <span class="tok-p">)</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-s2">&quot;Press Ctrl+Shift+P to bring up the command palette&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">text</span><span class="tok-p">(</span><span class="tok-sa">f</span><span class="tok-s2">&quot;</span><span class="tok-si">{</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">counter</span><span class="tok-si">=}</span><span class="tok-s2">&quot;</span><span class="tok-p">)</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_cool_bar</span><span class="tok-p">():</span>
    <span class="tok-c1"># Function to show a CoolBar button</span>
    <span class="tok-k">def</span> <span class="tok-nf">show_cool_bar_button</span><span class="tok-p">(</span><span class="tok-n">label</span><span class="tok-p">):</span>
        <span class="tok-n">w</span> <span class="tok-o">=</span> <span class="tok-n">im_cool_bar</span><span class="tok-o">.</span><span class="tok-n">get_cool_bar_item_width</span><span class="tok-p">()</span>

        <span class="tok-c1"># Display transparent image and check if clicked</span>
        <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">image_from_asset</span><span class="tok-p">(</span><span class="tok-s2">&quot;images/bear_transparent.png&quot;</span><span class="tok-p">,</span> <span class="tok-n">ImVec2</span><span class="tok-p">(</span><span class="tok-n">w</span><span class="tok-p">,</span> <span class="tok-n">w</span><span class="tok-p">))</span>
        <span class="tok-n">clicked</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_item_hovered</span><span class="tok-p">()</span> <span class="tok-ow">and</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">is_mouse_clicked</span><span class="tok-p">(</span><span class="tok-mi">0</span><span class="tok-p">)</span>

        <span class="tok-c1"># Optional: add a label on the image</span>
        <span class="tok-n">top_left_corner</span> <span class="tok-o">=</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_item_rect_min</span><span class="tok-p">()</span>
        <span class="tok-n">text_pos</span> <span class="tok-o">=</span> <span class="tok-n">ImVec2</span><span class="tok-p">(</span>
            <span class="tok-n">top_left_corner</span><span class="tok-o">.</span><span class="tok-n">x</span> <span class="tok-o">+</span> <span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">(</span><span class="tok-mf">1.0</span><span class="tok-p">),</span>
            <span class="tok-n">top_left_corner</span><span class="tok-o">.</span><span class="tok-n">y</span> <span class="tok-o">+</span> <span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">em_size</span><span class="tok-p">(</span><span class="tok-mf">1.0</span><span class="tok-p">),</span>
        <span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">get_window_draw_list</span><span class="tok-p">()</span><span class="tok-o">.</span><span class="tok-n">add_text</span><span class="tok-p">(</span><span class="tok-n">text_pos</span><span class="tok-p">,</span> <span class="tok-mh">0xFFFFFFFF</span><span class="tok-p">,</span> <span class="tok-n">label</span><span class="tok-p">)</span>

        <span class="tok-k">return</span> <span class="tok-n">clicked</span>

    <span class="tok-n">button_labels</span> <span class="tok-o">=</span> <span class="tok-p">[</span><span class="tok-s2">&quot;A&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;B&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;C&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;D&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;E&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;F&quot;</span><span class="tok-p">]</span>
    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render_unindented</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">        # ImCoolBar</span>
<span class="tok-sd">        ImCoolBar provides a dock-like Cool bar for Dear ImGui</span>
<span class="tok-sd">        &quot;&quot;&quot;</span>
    <span class="tok-p">)</span>

    <span class="tok-n">cool_bar_config</span> <span class="tok-o">=</span> <span class="tok-n">im_cool_bar</span><span class="tok-o">.</span><span class="tok-n">ImCoolBarConfig</span><span class="tok-p">()</span>
    <span class="tok-n">cool_bar_config</span><span class="tok-o">.</span><span class="tok-n">anchor</span> <span class="tok-o">=</span> <span class="tok-n">ImVec2</span><span class="tok-p">(</span>
        <span class="tok-mf">0.5</span><span class="tok-p">,</span> <span class="tok-mf">0.07</span>
    <span class="tok-p">)</span>  <span class="tok-c1">#  position in the window (ratio of window size)</span>
    <span class="tok-k">if</span> <span class="tok-n">im_cool_bar</span><span class="tok-o">.</span><span class="tok-n">begin_cool_bar</span><span class="tok-p">(</span>
        <span class="tok-s2">&quot;##CoolBarMain&quot;</span><span class="tok-p">,</span> <span class="tok-n">im_cool_bar</span><span class="tok-o">.</span><span class="tok-n">ImCoolBarFlags_</span><span class="tok-o">.</span><span class="tok-n">horizontal</span><span class="tok-o">.</span><span class="tok-n">value</span><span class="tok-p">,</span> <span class="tok-n">cool_bar_config</span>
    <span class="tok-p">):</span>
        <span class="tok-k">for</span> <span class="tok-n">label</span> <span class="tok-ow">in</span> <span class="tok-n">button_labels</span><span class="tok-p">:</span>
            <span class="tok-k">if</span> <span class="tok-n">im_cool_bar</span><span class="tok-o">.</span><span class="tok-n">cool_bar_item</span><span class="tok-p">():</span>
                <span class="tok-k">if</span> <span class="tok-n">show_cool_bar_button</span><span class="tok-p">(</span><span class="tok-n">label</span><span class="tok-p">):</span>
                    <span class="tok-nb">print</span><span class="tok-p">(</span><span class="tok-sa">f</span><span class="tok-s2">&quot;Clicked </span><span class="tok-si">{</span><span class="tok-n">label</span><span class="tok-si">}</span><span class="tok-s2">&quot;</span><span class="tok-p">)</span>
        <span class="tok-n">im_cool_bar</span><span class="tok-o">.</span><span class="tok-n">end_cool_bar</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>


<span class="tok-k">def</span> <span class="tok-nf">demo_gui</span><span class="tok-p">():</span>
    <span class="tok-n">demo_cool_bar</span><span class="tok-p">()</span>
    <span class="tok-n">demo_toggle</span><span class="tok-p">()</span>
    <span class="tok-n">demo_spinner</span><span class="tok-p">()</span>
    <span class="tok-n">demo_knobs</span><span class="tok-p">()</span>
    <span class="tok-n">demo_command_palette</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>
    <span class="tok-n">demo_portable_file_dialogs</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">new_line</span><span class="tok-p">()</span>
    <span class="tok-n">demo_imfile_dialog</span><span class="tok-p">()</span>


<span class="tok-k">if</span> <span class="tok-vm">__name__</span> <span class="tok-o">==</span> <span class="tok-s2">&quot;__main__&quot;</span><span class="tok-p">:</span>
    <span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle.demos_python</span> <span class="tok-kn">import</span> <span class="tok-n">demo_utils</span>
    <span class="tok-n">demo_utils</span><span class="tok-o">.</span><span class="tok-n">set_hello_imgui_demo_assets_folder</span><span class="tok-p">()</span>

    <span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">immapp</span>
    <span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">run</span><span class="tok-p">(</span><span class="tok-n">demo_gui</span><span class="tok-p">,</span> <span class="tok-n">with_markdown</span><span class="tok-o">=</span><span class="tok-kc">True</span><span class="tok-p">,</span> <span class="tok-n">window_size</span><span class="tok-o">=</span><span class="tok-p">(</span><span class="tok-mi">1000</span><span class="tok-p">,</span> <span class="tok-mi">1000</span><span class="tok-p">))</span>  <span class="tok-c1"># type: ignore</span></code></pre>
</div>
</div>
</div>
</details>
<hr>
</div>
<div class="sect3">
<h4 id="_logger">Logger</h4>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_widgets_logger.jpg" alt="demo widgets logger" width="400">
</div>
<div class="title">Figure 16. Logger</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_logger.html">Try the logger in your browser</a></p>
</div>
<details>
<summary class="title">Click to see the logger code in C&#43;&#43;</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cpp"><span></span><span class="tok-c1">// Part of ImGui Bundle - MIT License - Copyright (c) 2022-2024 Pascal Thomet - https://github.com/pthom/imgui_bundle</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui_md_wrapper/imgui_md_wrapper.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;immapp/immapp.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;hello_imgui/hello_imgui.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;demo_utils/api_demos.h&quot;</span>

<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;vector&gt;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;string&gt;</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">demo_logger</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">vector</span><span class="tok-o">&lt;</span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-o">&gt;</span><span class="tok-w"> </span><span class="tok-n">fortunes</span><span class="tok-w"> </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-s">&quot;If at first you don&#39;t succeed, skydiving is not for you.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;You will be a winner today. Pick a fight.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;The world may be your oyster, but it doesn&#39;t mean you&#39;ll get its pearl.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;Borrow money from a pessimist, they don&#39;t expect it back.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;You will be hungry again in an hour.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;A closed mouth gathers no foot.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;Today, you will invent the wheel...again.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;If you can&#39;t convince them, confuse them.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;The journey of a thousand miles begins with a single step, or a really good map.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;You will find a pot of gold at the end of a rainbow, but it&#39;ll be someone else&#39;s.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;Opportunities will knock on your door, but don&#39;t worry, they&#39;ll be gone by the time you get up to answer.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;You will have a long and healthy life...and a very boring one.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;A wise man once said nothing.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;You will have a great day...tomorrow.&quot;</span><span class="tok-p">,</span>
<span class="tok-w">        </span><span class="tok-s">&quot;The only thing constant in life is change, except for death and taxes, those are pretty constant too.&quot;</span>
<span class="tok-w">    </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">size_t</span><span class="tok-w"> </span><span class="tok-n">idxFortune</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>

<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">addLogs</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]()</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">for</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-n">i</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span><span class="tok-w"> </span><span class="tok-n">i</span><span class="tok-w"> </span><span class="tok-o">&lt;</span><span class="tok-w"> </span><span class="tok-mi">10</span><span class="tok-p">;</span><span class="tok-w"> </span><span class="tok-o">++</span><span class="tok-n">i</span><span class="tok-p">)</span>
<span class="tok-w">        </span><span class="tok-p">{</span>
<span class="tok-w">            </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-w"> </span><span class="tok-n">logLevel</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogLevel</span><span class="tok-p">(</span><span class="tok-n">rand</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">%</span><span class="tok-w"> </span><span class="tok-mi">4</span><span class="tok-p">);</span>
<span class="tok-w">            </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">Log</span><span class="tok-p">(</span><span class="tok-n">logLevel</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">fortunes</span><span class="tok-p">[</span><span class="tok-n">idxFortune</span><span class="tok-p">].</span><span class="tok-n">c_str</span><span class="tok-p">());</span>
<span class="tok-w">            </span><span class="tok-o">++</span><span class="tok-w"> </span><span class="tok-n">idxFortune</span><span class="tok-p">;</span>
<span class="tok-w">            </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">idxFortune</span><span class="tok-w"> </span><span class="tok-o">&gt;=</span><span class="tok-w"> </span><span class="tok-n">fortunes</span><span class="tok-p">.</span><span class="tok-n">size</span><span class="tok-p">())</span>
<span class="tok-w">                </span><span class="tok-n">idxFortune</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-mi">0</span><span class="tok-p">;</span>
<span class="tok-w">        </span><span class="tok-p">}</span>
<span class="tok-w">    </span><span class="tok-p">};</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-kt">bool</span><span class="tok-w"> </span><span class="tok-n">addedLogs</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">false</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-o">!</span><span class="tok-w"> </span><span class="tok-n">addedLogs</span><span class="tok-p">)</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-n">addLogs</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-n">addedLogs</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-nb">true</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-p">}</span>

<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">RenderUnindented</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s">        # Graphical logger for ImGui</span>
<span class="tok-s">        This logger is adapted from [ImGuiAl](https://github.com/leiradel/ImGuiAl)</span>

<span class="tok-s">        Its colors are computed automatically from the WindowBg color, in order to remain readable when the theme is changed.</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Button</span><span class="tok-p">(</span><span class="tok-s">&quot;Add logs&quot;</span><span class="tok-p">))</span>
<span class="tok-w">        </span><span class="tok-n">addLogs</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">Separator</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">HelloImGui</span><span class="tok-o">::</span><span class="tok-n">LogGui</span><span class="tok-p">();</span>
<span class="tok-p">}</span></code></pre>
</div>
</div>
</div>
</details>
<details>
<summary class="title">Click to see the logger code in Python</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="python"><span></span><span class="tok-c1"># Part of ImGui Bundle - MIT License - Copyright (c) 2022-2025 Pascal Thomet - https://github.com/pthom/imgui_bundle</span>
<span class="tok-kn">import</span> <span class="tok-nn">random</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">imgui</span><span class="tok-p">,</span> <span class="tok-n">hello_imgui</span><span class="tok-p">,</span> <span class="tok-n">imgui_md</span><span class="tok-p">,</span> <span class="tok-n">immapp</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle.demos_python.demo_utils</span> <span class="tok-kn">import</span> <span class="tok-n">api_demos</span>


<span class="tok-nd">@immapp</span><span class="tok-o">.</span><span class="tok-n">static</span><span class="tok-p">(</span><span class="tok-n">idx_fortune</span><span class="tok-o">=</span><span class="tok-mi">0</span><span class="tok-p">,</span> <span class="tok-n">added_logs</span><span class="tok-o">=</span><span class="tok-kc">False</span><span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_gui</span><span class="tok-p">():</span>
    <span class="tok-n">static</span> <span class="tok-o">=</span> <span class="tok-n">demo_gui</span>
    <span class="tok-n">fortunes</span> <span class="tok-o">=</span> <span class="tok-p">[</span>
        <span class="tok-s2">&quot;If at first you don&#39;t succeed, skydiving is not for you.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;You will be a winner today. Pick a fight.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;The world may be your oyster, but it doesn&#39;t mean you&#39;ll get its pearl.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;Borrow money from a pessimist, they don&#39;t expect it back.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;You will be hungry again in an hour.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;A closed mouth gathers no foot.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;Today, you will invent the wheel...again.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;If you can&#39;t convince them, confuse them.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;The journey of a thousand miles begins with a single step, or a really good map.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;You will find a pot of gold at the end of a rainbow, but it&#39;ll be someone else&#39;s.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;Opportunities will knock on your door, but don&#39;t worry, they&#39;ll be gone by the time you get up to answer.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;You will have a long and healthy life...and a very boring one.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;A wise man once said nothing.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;You will have a great day...tomorrow.&quot;</span><span class="tok-p">,</span>
        <span class="tok-s2">&quot;The only thing constant in life is change, except for death and taxes, those are pretty constant too.&quot;</span><span class="tok-p">,</span>
    <span class="tok-p">]</span>

    <span class="tok-k">def</span> <span class="tok-nf">add_logs</span><span class="tok-p">():</span>
        <span class="tok-k">for</span> <span class="tok-n">_i</span> <span class="tok-ow">in</span> <span class="tok-nb">range</span><span class="tok-p">(</span><span class="tok-mi">10</span><span class="tok-p">):</span>
            <span class="tok-n">log_level</span> <span class="tok-o">=</span> <span class="tok-n">random</span><span class="tok-o">.</span><span class="tok-n">choice</span><span class="tok-p">(</span>
                <span class="tok-p">[</span>
                    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">debug</span><span class="tok-p">,</span>
                    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">info</span><span class="tok-p">,</span>
                    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">warning</span><span class="tok-p">,</span>
                    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">LogLevel</span><span class="tok-o">.</span><span class="tok-n">error</span><span class="tok-p">,</span>
                <span class="tok-p">]</span>
            <span class="tok-p">)</span>
            <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log</span><span class="tok-p">(</span><span class="tok-n">log_level</span><span class="tok-p">,</span> <span class="tok-n">fortunes</span><span class="tok-p">[</span><span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">idx_fortune</span><span class="tok-p">])</span>
            <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">idx_fortune</span> <span class="tok-o">+=</span> <span class="tok-mi">1</span>
            <span class="tok-k">if</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">idx_fortune</span> <span class="tok-o">&gt;=</span> <span class="tok-nb">len</span><span class="tok-p">(</span><span class="tok-n">fortunes</span><span class="tok-p">):</span>
                <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">idx_fortune</span> <span class="tok-o">=</span> <span class="tok-mi">0</span>

    <span class="tok-k">if</span> <span class="tok-ow">not</span> <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">added_logs</span><span class="tok-p">:</span>
        <span class="tok-n">add_logs</span><span class="tok-p">()</span>
        <span class="tok-n">static</span><span class="tok-o">.</span><span class="tok-n">added_logs</span> <span class="tok-o">=</span> <span class="tok-kc">True</span>

    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render_unindented</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd">        # Graphical logger for ImGui</span>
<span class="tok-sd">        This logger is adapted from [ImGuiAl](https://github.com/leiradel/ImGuiAl)</span>

<span class="tok-sd">        Its colors are computed automatically from the WindowBg color, in order to remain readable when the theme is changed.</span>
<span class="tok-sd">        &quot;&quot;&quot;</span>
    <span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>

    <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Add logs&quot;</span><span class="tok-p">):</span>
        <span class="tok-k">for</span> <span class="tok-n">_i</span> <span class="tok-ow">in</span> <span class="tok-nb">range</span><span class="tok-p">(</span><span class="tok-mi">10</span><span class="tok-p">):</span>
            <span class="tok-n">add_logs</span><span class="tok-p">()</span>

    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">separator</span><span class="tok-p">()</span>
    <span class="tok-n">hello_imgui</span><span class="tok-o">.</span><span class="tok-n">log_gui</span><span class="tok-p">()</span>


<span class="tok-k">def</span> <span class="tok-nf">main</span><span class="tok-p">():</span>
    <span class="tok-n">api_demos</span><span class="tok-o">.</span><span class="tok-n">set_hello_imgui_demo_assets_folder</span><span class="tok-p">()</span>
    <span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">run</span><span class="tok-p">(</span><span class="tok-n">demo_gui</span><span class="tok-p">,</span> <span class="tok-s2">&quot;Log&quot;</span><span class="tok-p">,</span> <span class="tok-n">with_markdown</span><span class="tok-o">=</span><span class="tok-kc">True</span><span class="tok-p">)</span>


<span class="tok-k">if</span> <span class="tok-vm">__name__</span> <span class="tok-o">==</span> <span class="tok-s2">&quot;__main__&quot;</span><span class="tok-p">:</span>
    <span class="tok-n">main</span><span class="tok-p">()</span></code></pre>
</div>
</div>
</div>
</details>
<hr>
</div>
<div class="sect3">
<h4 id="_code_editor">Code Editor</h4>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_widgets_editor.jpg" alt="demo widgets editor" width="400">
</div>
<div class="title">Figure 17. Code editor</div>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_text_edit.html">Try the code editor in your browser</a></p>
</div>
<details>
<summary class="title">Click to see the code editor code in C&#43;&#43;</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="cpp"><span></span><span class="tok-c1">// Part of ImGui Bundle - MIT License - Copyright (c) 2022-2024 Pascal Thomet - https://github.com/pthom/imgui_bundle</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;imgui.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;immapp/immapp.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&quot;ImGuiColorTextEdit/TextEditor.h&quot;</span>
<span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf">&lt;fplus/fplus.hpp&gt;</span>

<span class="tok-n">TextEditor</span><span class="tok-w"> </span><span class="tok-nf">_PrepareTextEditor</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-n">TextEditor</span><span class="tok-w"> </span><span class="tok-n">editor</span><span class="tok-p">;</span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">filename</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">__FILE__</span><span class="tok-p">;</span>
<span class="tok-cp">#ifndef __EMSCRIPTEN__</span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">this_file_code</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">fplus</span><span class="tok-o">::</span><span class="tok-n">read_text_file</span><span class="tok-p">(</span><span class="tok-n">filename</span><span class="tok-p">)();</span>
<span class="tok-cp">#else</span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">string</span><span class="tok-w"> </span><span class="tok-n">this_file_code</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">fplus</span><span class="tok-o">::</span><span class="tok-n">read_text_file</span><span class="tok-p">(</span><span class="tok-s">&quot;/demos_cpp/demo_text_edit.cpp&quot;</span><span class="tok-p">)();</span>
<span class="tok-cp">#endif</span>
<span class="tok-w">    </span><span class="tok-n">editor</span><span class="tok-p">.</span><span class="tok-n">SetText</span><span class="tok-p">(</span><span class="tok-n">this_file_code</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">editor</span><span class="tok-p">.</span><span class="tok-n">SetLanguageDefinition</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">::</span><span class="tok-n">LanguageDefinitionId</span><span class="tok-o">::</span><span class="tok-n">Cpp</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-k">return</span><span class="tok-w"> </span><span class="tok-n">editor</span><span class="tok-p">;</span>
<span class="tok-p">}</span>


<span class="tok-kt">void</span><span class="tok-w"> </span><span class="tok-nf">demo_text_edit</span><span class="tok-p">()</span>
<span class="tok-p">{</span>
<span class="tok-w">    </span><span class="tok-k">static</span><span class="tok-w"> </span><span class="tok-n">TextEditor</span><span class="tok-w"> </span><span class="tok-n">editor</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">_PrepareTextEditor</span><span class="tok-p">();</span>

<span class="tok-w">    </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">Render</span><span class="tok-p">(</span><span class="tok-sa">R</span><span class="tok-s">&quot;</span><span class="tok-dl">(</span>
<span class="tok-s"># ImGuiColorTextEdit</span>
<span class="tok-s">[ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit)  is a colorizing text editor for ImGui, able to colorize C, C++, hlsl, Sql, angel_script and lua code</span>
<span class="tok-s">    </span><span class="tok-dl">)</span><span class="tok-s">&quot;</span><span class="tok-p">);</span>

<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">ShowPaletteButtons</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-p">[]()</span>
<span class="tok-w">    </span><span class="tok-p">{</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SmallButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Dark palette&quot;</span><span class="tok-p">))</span>
<span class="tok-w">            </span><span class="tok-n">editor</span><span class="tok-p">.</span><span class="tok-n">SetPalette</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">::</span><span class="tok-n">PaletteId</span><span class="tok-o">::</span><span class="tok-n">Dark</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SmallButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Light palette&quot;</span><span class="tok-p">))</span>
<span class="tok-w">            </span><span class="tok-n">editor</span><span class="tok-p">.</span><span class="tok-n">SetPalette</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">::</span><span class="tok-n">PaletteId</span><span class="tok-o">::</span><span class="tok-n">Light</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SmallButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Retro blue palette&quot;</span><span class="tok-p">))</span>
<span class="tok-w">            </span><span class="tok-n">editor</span><span class="tok-p">.</span><span class="tok-n">SetPalette</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">::</span><span class="tok-n">PaletteId</span><span class="tok-o">::</span><span class="tok-n">RetroBlue</span><span class="tok-p">);</span>
<span class="tok-w">        </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SameLine</span><span class="tok-p">();</span>
<span class="tok-w">        </span><span class="tok-k">if</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">SmallButton</span><span class="tok-p">(</span><span class="tok-s">&quot;Mariana palette&quot;</span><span class="tok-p">))</span>
<span class="tok-w">            </span><span class="tok-n">editor</span><span class="tok-p">.</span><span class="tok-n">SetPalette</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">::</span><span class="tok-n">PaletteId</span><span class="tok-o">::</span><span class="tok-n">Mariana</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-p">};</span>

<span class="tok-w">    </span><span class="tok-n">ShowPaletteButtons</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-k">auto</span><span class="tok-w"> </span><span class="tok-n">codeFont</span><span class="tok-w"> </span><span class="tok-o">=</span><span class="tok-w"> </span><span class="tok-n">ImGuiMd</span><span class="tok-o">::</span><span class="tok-n">GetCodeFont</span><span class="tok-p">();</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PushFont</span><span class="tok-p">(</span><span class="tok-n">codeFont</span><span class="tok-p">.</span><span class="tok-n">font</span><span class="tok-p">,</span><span class="tok-w"> </span><span class="tok-n">codeFont</span><span class="tok-p">.</span><span class="tok-n">size</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">editor</span><span class="tok-p">.</span><span class="tok-n">Render</span><span class="tok-p">(</span><span class="tok-s">&quot;Code&quot;</span><span class="tok-p">);</span>
<span class="tok-w">    </span><span class="tok-n">ImGui</span><span class="tok-o">::</span><span class="tok-n">PopFont</span><span class="tok-p">();</span>
<span class="tok-p">}</span></code></pre>
</div>
</div>
</div>
</details>
<details>
<summary class="title">Click to see the code editor code in Python</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="python"><span></span><span class="tok-c1"># Part of ImGui Bundle - MIT License - Copyright (c) 2022-2025 Pascal Thomet - https://github.com/pthom/imgui_bundle</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">imgui</span><span class="tok-p">,</span> <span class="tok-n">imgui_color_text_edit</span> <span class="tok-k">as</span> <span class="tok-n">ed</span><span class="tok-p">,</span> <span class="tok-n">imgui_md</span>
<span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle.immapp</span> <span class="tok-kn">import</span> <span class="tok-n">static</span>

<span class="tok-n">TextEditor</span> <span class="tok-o">=</span> <span class="tok-n">ed</span><span class="tok-o">.</span><span class="tok-n">TextEditor</span>


<span class="tok-k">def</span> <span class="tok-nf">_prepare_text_editor</span><span class="tok-p">():</span>
    <span class="tok-k">with</span> <span class="tok-nb">open</span><span class="tok-p">(</span><span class="tok-vm">__file__</span><span class="tok-p">,</span> <span class="tok-n">encoding</span><span class="tok-o">=</span><span class="tok-s2">&quot;utf8&quot;</span><span class="tok-p">)</span> <span class="tok-k">as</span> <span class="tok-n">f</span><span class="tok-p">:</span>
        <span class="tok-n">this_file_code</span> <span class="tok-o">=</span> <span class="tok-n">f</span><span class="tok-o">.</span><span class="tok-n">read</span><span class="tok-p">()</span>
    <span class="tok-n">editor</span> <span class="tok-o">=</span> <span class="tok-n">TextEditor</span><span class="tok-p">()</span>
    <span class="tok-n">editor</span><span class="tok-o">.</span><span class="tok-n">set_text</span><span class="tok-p">(</span><span class="tok-n">this_file_code</span><span class="tok-p">)</span>
    <span class="tok-n">editor</span><span class="tok-o">.</span><span class="tok-n">set_language_definition</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">.</span><span class="tok-n">LanguageDefinitionId</span><span class="tok-o">.</span><span class="tok-n">python</span><span class="tok-p">)</span>
    <span class="tok-k">return</span> <span class="tok-n">editor</span>


<span class="tok-nd">@static</span><span class="tok-p">(</span><span class="tok-n">editor</span><span class="tok-o">=</span><span class="tok-kc">None</span><span class="tok-p">)</span>
<span class="tok-k">def</span> <span class="tok-nf">demo_gui</span><span class="tok-p">():</span>
    <span class="tok-k">if</span> <span class="tok-n">demo_gui</span><span class="tok-o">.</span><span class="tok-n">editor</span> <span class="tok-ow">is</span> <span class="tok-kc">None</span><span class="tok-p">:</span>
        <span class="tok-n">demo_gui</span><span class="tok-o">.</span><span class="tok-n">editor</span> <span class="tok-o">=</span> <span class="tok-n">_prepare_text_editor</span><span class="tok-p">()</span>
    <span class="tok-n">editor</span> <span class="tok-o">=</span> <span class="tok-n">demo_gui</span><span class="tok-o">.</span><span class="tok-n">editor</span>

    <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">render</span><span class="tok-p">(</span>
<span class="tok-w">        </span><span class="tok-sd">&quot;&quot;&quot;</span>
<span class="tok-sd"># ImGuiColorTextEdit</span>
<span class="tok-sd">[ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit)  is a colorizing text editor for ImGui, able to colorize C, C++, hlsl, Sql, angel_script and lua code</span>
<span class="tok-sd">    &quot;&quot;&quot;</span>
    <span class="tok-p">)</span>

    <span class="tok-k">def</span> <span class="tok-nf">show_palette_buttons</span><span class="tok-p">():</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">small_button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Dark palette&quot;</span><span class="tok-p">):</span>
            <span class="tok-n">editor</span><span class="tok-o">.</span><span class="tok-n">set_palette</span><span class="tok-p">(</span><span class="tok-n">ed</span><span class="tok-o">.</span><span class="tok-n">TextEditor</span><span class="tok-o">.</span><span class="tok-n">PaletteId</span><span class="tok-o">.</span><span class="tok-n">dark</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">small_button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Light palette&quot;</span><span class="tok-p">):</span>
            <span class="tok-n">editor</span><span class="tok-o">.</span><span class="tok-n">set_palette</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">.</span><span class="tok-n">PaletteId</span><span class="tok-o">.</span><span class="tok-n">light</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">small_button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Retro blue palette&quot;</span><span class="tok-p">):</span>
            <span class="tok-n">editor</span><span class="tok-o">.</span><span class="tok-n">set_palette</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">.</span><span class="tok-n">PaletteId</span><span class="tok-o">.</span><span class="tok-n">retro_blue</span><span class="tok-p">)</span>
        <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">same_line</span><span class="tok-p">()</span>
        <span class="tok-k">if</span> <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">small_button</span><span class="tok-p">(</span><span class="tok-s2">&quot;Mariana palette&quot;</span><span class="tok-p">):</span>
            <span class="tok-n">editor</span><span class="tok-o">.</span><span class="tok-n">set_palette</span><span class="tok-p">(</span><span class="tok-n">TextEditor</span><span class="tok-o">.</span><span class="tok-n">PaletteId</span><span class="tok-o">.</span><span class="tok-n">mariana</span><span class="tok-p">)</span>

    <span class="tok-n">show_palette_buttons</span><span class="tok-p">()</span>
    <span class="tok-n">code_font</span> <span class="tok-o">=</span> <span class="tok-n">imgui_md</span><span class="tok-o">.</span><span class="tok-n">get_code_font</span><span class="tok-p">()</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">push_font</span><span class="tok-p">(</span><span class="tok-n">code_font</span><span class="tok-o">.</span><span class="tok-n">font</span><span class="tok-p">,</span> <span class="tok-n">code_font</span><span class="tok-o">.</span><span class="tok-n">size</span><span class="tok-p">)</span>
    <span class="tok-n">editor</span><span class="tok-o">.</span><span class="tok-n">render</span><span class="tok-p">(</span><span class="tok-s2">&quot;Code&quot;</span><span class="tok-p">)</span>
    <span class="tok-n">imgui</span><span class="tok-o">.</span><span class="tok-n">pop_font</span><span class="tok-p">()</span>


<span class="tok-k">def</span> <span class="tok-nf">main</span><span class="tok-p">():</span>
    <span class="tok-kn">from</span> <span class="tok-nn">imgui_bundle</span> <span class="tok-kn">import</span> <span class="tok-n">immapp</span>

    <span class="tok-n">immapp</span><span class="tok-o">.</span><span class="tok-n">run</span><span class="tok-p">(</span><span class="tok-n">demo_gui</span><span class="tok-p">,</span> <span class="tok-n">with_markdown</span><span class="tok-o">=</span><span class="tok-kc">True</span><span class="tok-p">)</span>


<span class="tok-k">if</span> <span class="tok-vm">__name__</span> <span class="tok-o">==</span> <span class="tok-s2">&quot;__main__&quot;</span><span class="tok-p">:</span>
    <span class="tok-n">main</span><span class="tok-p">()</span></code></pre>
</div>
</div>
</div>
</details>
</div>
<div class="sect3">
<h4 id="_and_many_more">And many more!</h4>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<div class="title">Tip</div>
</td>
<td class="content">
Tip: use the interactive manual as an inspiration
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p><a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_imgui_bundle.html"><span class="image"><img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_immapp_apps.jpg" alt="demo immapp apps" width="400"></span></a></p>
</div>
<div class="paragraph">
<p>The <a href="https://traineq.org/ImGuiBundle/emscripten/bin/demo_imgui_bundle.html">interactive manual</a> provides many demos, <em>with easy access to their code</em>. It includes all the examples that are explained here, and many more.</p>
</div>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_node_editor.jpg" alt="demo node editor" width="400">
</div>
<div class="title">Figure 18. ImGui Node editor in action</div>
</div>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/pthom/imgui_bundle/main/bindings/imgui_bundle/doc/doc_images/demo_gizmo.jpg" alt="demo gizmo" width="400">
</div>
<div class="title">Figure 19. ImGuizmo in action</div>
</div>
</div>
</div>
</div>
</div>
<div class="paragraph nav-footer">
<p>← Previous: <a href="install_cpp.html">Install for C&#43;&#43;</a> | ↑ Up: <a href="index.html">Dear ImGui Bundle</a> | Next: <a href="assets_about.html">Assets</a> →</p>
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2025-11-09 18:36:20 +0100
</div>
</div>
</body>
</html>